name: Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-release
run: cargo install cargo-release
- name: Configure Git user
run: |
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
- name: Run cargo release (Patch Bump)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
# --workspace handles bumping version for all members if needed
# --no-confirm skips interactive prompts
# --execute performs the actions (remove for dry-run)
# 'patch' specifies the version bump level (can be minor, major, etc.)
# cargo-release will bump version, commit, tag, push, and publish
cargo release --workspace patch --no-confirm --execute
# If you prefer to separate push and publish:
# cargo release --workspace patch --no-publish --no-push --no-tag --no-confirm --execute # Just bumps version and commits locally
# git push --follow-tags # Push commit and generated tag
# cargo publish --token ${CARGO_REGISTRY_TOKEN}