Release #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "*-v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Crate tag to release, e.g. crypto-vault-v1.0.0" | |
| required: true | |
| jobs: | |
| release: | |
| name: release (${{ github.event.inputs.tag || github.ref_name }}) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag || github.ref_name }} | |
| - name: Derive crate name and version from tag | |
| id: tag | |
| run: | | |
| TAG="${{ github.event.inputs.tag || github.ref_name }}" | |
| PACKAGE="${TAG%-v*}" | |
| VERSION="${TAG##*-v}" | |
| echo "package=${PACKAGE}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Test | |
| working-directory: ${{ steps.tag.outputs.package }} | |
| run: cargo test --all-features | |
| - name: Package crate | |
| working-directory: ${{ steps.tag.outputs.package }} | |
| run: cargo package --allow-dirty | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: "${{ steps.tag.outputs.package }} v${{ steps.tag.outputs.version }}" | |
| body_path: ${{ steps.tag.outputs.package }}/CHANGELOG.md | |
| files: ${{ steps.tag.outputs.package }}/target/package/*.crate |