Release run 'release/0.21.2' #37
Workflow file for this run
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 | |
| run-name: "Release run '${{ github.head_ref || github.ref_name }}'" | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| semver: | |
| name: semver | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Check semver | |
| uses: obi1kenobi/cargo-semver-checks-action@6b69fcf40e9b5fb17adeb57e4b6ecd020649a239 # v2.9 | |
| release: | |
| name: Process Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # stable | |
| with: | |
| toolchain: stable | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Install a TOML parser | |
| run: | | |
| curl -L https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-full-linux-x86_64.gz | gunzip - > taplo | |
| chmod +x taplo | |
| sudo mv taplo /usr/bin/taplo | |
| - name: Configure git | |
| run: | | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config user.name "github-actions[bot]" | |
| git config --add --bool push.autoSetupRemote true | |
| - name: Extract version from branch name | |
| id: version | |
| run: | | |
| BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
| VERSION="${BRANCH_NAME#release/}" | |
| echo "Version from branch: $VERSION" | |
| # Validate version matches Cargo.toml | |
| CARGO_VERSION=$(taplo get -f Cargo.toml "package.version") | |
| if [ "$VERSION" != "$CARGO_VERSION" ]; then | |
| echo "Error: Branch version ($VERSION) doesn't match Cargo.toml version ($CARGO_VERSION)" | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| run: | | |
| git tag -a "v${{ steps.version.outputs.version }}" -m "Release version ${{ steps.version.outputs.version }}" | |
| git push origin "v${{ steps.version.outputs.version }}" | |
| - name: Publish crate | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: cargo publish | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: Release ${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |