1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Update
on:
# Auto-create / update the release PR on every push to main. release-plz
# internally checks whether there's anything releasable since the last tag —
# if not (e.g. the push was a pure chore: / style: commit that our parser
# skips, and no other unreleased work exists), no PR is created or updated.
# Manual trigger is kept so you can force a refresh if needed.
workflow_dispatch:
push:
branches:
permissions:
contents: write
pull-requests: write
concurrency:
# Single in-flight release-PR update per branch — rapid pushes coalesce so
# we only do the work once, against the latest commit.
group: update-${{ github.ref }}
cancel-in-progress: true
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 15
# Skip when the push is the release-PR merge commit itself (release-plz
# would just no-op anyway, but the CI run still takes ~2 minutes).
# workflow_dispatch always runs so you can force a refresh if needed.
if: >-
github.event_name == 'workflow_dispatch' ||
!startsWith(github.event.head_commit.message, 'chore: release')
steps:
- name: Clone repository
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Rust version
id: rust-version
run: |
RUST_VERSION=$(grep '^rust-version = ' Cargo.toml | sed 's/rust-version = "\(.*\)"/\1/')
echo "version=$RUST_VERSION" >> $GITHUB_OUTPUT
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.rust-version.outputs.version }}
- name: Install nightly Rust for formatting
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: msrv
# Format before release-plz so any formatting changes are included in the release PR
- name: Format code with nightly
run: cargo +nightly fmt
- name: Install release-plz
uses: taiki-e/install-action@v2
with:
tool: release-plz
- name: Create release PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release-plz release-pr --git-token "$GITHUB_TOKEN" || {
echo "::error::release-plz release-pr failed"
exit 1
}