name: release
on:
workflow_dispatch:
inputs:
bump:
description: Version bump
required: true
type: choice
options: [patch, minor, major]
permissions: {}
concurrency: { group: release, cancel-in-progress: false }
jobs:
build:
uses: ./.github/workflows/build.yml
release:
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with: { tool: cargo-release }
- name: Configure git identity
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Bump, commit, tag
run: |
cargo release version "${{ inputs.bump }}" --execute --no-confirm
VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
git commit -am "chore: release v${VERSION}"
git tag "v${VERSION}"
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- run: git push --atomic origin HEAD "v${VERSION}"
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
- run: gh release create "v${VERSION}" --generate-notes --verify-tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}