ci: fix release-plz workflow for auto release on main (#10)

* Create release-plz.yml

* ci: configure release-plz auto-release workflow

* ci: allow crates token from env vars fallback

* ci: add release-pr flow and release commit filtering
This commit is contained in:
Milind Sharma 2026-02-22 20:40:05 +08:00 committed by GitHub
parent 0494561a21
commit 1b448b9d75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 60 additions and 0 deletions

54
.github/workflows/release-plz.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: release-plz
on:
push:
branches:
- main
workflow_dispatch:
jobs:
release-plz-release:
name: release-plz release
runs-on: ubuntu-latest
permissions:
contents: write
environment: CRATE_RELEASE
steps:
- &checkout
name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- &install-rust
name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN || vars.CARGO_REGISTRY_TOKEN }}
release-plz-pr:
name: release-plz PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- *checkout
- *install-rust
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN || vars.CARGO_REGISTRY_TOKEN }}

6
release-plz.toml Normal file
View File

@ -0,0 +1,6 @@
[workspace]
release_always = true
git_tag_enable = true
git_release_enable = true
publish = true
release_commits = '^(feat|fix|perf|refactor|revert|build)(\([^)]+\))?(!)?:'