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
name: release-plz
on:
push:
branches:
permissions:
contents: write
pull-requests: write
jobs:
# Opens/updates a "release" PR that bumps the version and updates CHANGELOG.md.
release-pr:
name: Release PR
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prefer a GitHub App token: the default GITHUB_TOKEN can't trigger
# downstream workflows, so a release PR opened with it wouldn't run CI, and
# an on-merge release wouldn't fire the binary build. The app id lives in a
# repo *variable* (secrets can't be read in `if:`); the private key is a
# secret. When the app isn't configured we fall back to GITHUB_TOKEN so the
# workflow still works — the release PR just opens without triggering CI.
# One-time setup is documented in CONTRIBUTING.md.
- uses: actions/create-github-app-token@v2
id: app-token
if: ${{ vars.RELEASE_PLZ_APP_ID != '' }}
with:
app-id: ${{ vars.RELEASE_PLZ_APP_ID }}
private-key: ${{ secrets.RELEASE_PLZ_APP_PRIVATE_KEY }}
- uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
# When the release PR is merged, publishes the crate to crates.io, tags the
# commit, and creates the GitHub Release (which triggers release-binaries.yml
# to upload binaries and bump the Homebrew tap).
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/create-github-app-token@v2
id: app-token
if: ${{ vars.RELEASE_PLZ_APP_ID != '' }}
with:
app-id: ${{ vars.RELEASE_PLZ_APP_ID }}
private-key: ${{ secrets.RELEASE_PLZ_APP_PRIVATE_KEY }}
- uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
# Authenticates `cargo publish`. Required for the crates.io release;
# add it as a repo secret (see CONTRIBUTING.md).
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}