Skip to content

Commit a743ec1

Browse files
committed
ci(release): replace cargo-release+gitmoji-changelog with release-plz
Removes BOM generation (stale, unused) and gitmoji-changelog. Replaces cargo-release with release-plz + git-cliff for version bumps, CHANGELOG updates, and crates.io publishing. Merges binary build and krew-update jobs into release-plz.yaml as conditional jobs (releases_created == true) to avoid the GITHUB_TOKEN cross-workflow trigger restriction — no PAT required. Existing tag format (no v-prefix) preserved via git_tag_name.
1 parent 7447c2a commit a743ec1

8 files changed

Lines changed: 175 additions & 2287 deletions

File tree

.github/workflows/release-plz.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: release-plz
2+
on:
3+
push:
4+
branches: [master]
5+
6+
jobs:
7+
release-pr:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: dtolnay/rust-toolchain@stable
17+
- uses: release-plz/action@v0.5
18+
with:
19+
command: release-pr
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
23+
24+
release:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write
28+
outputs:
29+
releases_created: ${{ steps.release-plz.outputs.releases_created }}
30+
tag: ${{ steps.tag.outputs.value }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
- uses: dtolnay/rust-toolchain@stable
36+
- id: release-plz
37+
uses: release-plz/action@v0.5
38+
with:
39+
command: release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
43+
- id: tag
44+
if: steps.release-plz.outputs.releases_created == 'true'
45+
env:
46+
RELEASES: ${{ steps.release-plz.outputs.releases }}
47+
run: echo "value=$(echo "$RELEASES" | jq -r '.[0].tag')" >> $GITHUB_OUTPUT
48+
49+
build:
50+
needs: release
51+
if: needs.release.outputs.releases_created == 'true'
52+
runs-on: ${{ matrix.os.imageName }}
53+
permissions:
54+
contents: write
55+
env:
56+
SCCACHE_GHA_ENABLED: "true"
57+
RUSTC_WRAPPER: "sccache"
58+
strategy:
59+
matrix:
60+
os:
61+
- { target_platform: x86_64-unknown-linux-gnu, imageName: ubuntu-latest, cross: "true" }
62+
- { target_platform: x86_64-unknown-linux-musl, imageName: ubuntu-latest, cross: "true" }
63+
- { target_platform: aarch64-unknown-linux-musl, imageName: ubuntu-latest, cross: "true" }
64+
- { target_platform: x86_64-apple-darwin, imageName: macOS-latest }
65+
- { target_platform: aarch64-apple-darwin, imageName: macOS-latest }
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
ref: ${{ needs.release.outputs.tag }}
70+
- uses: mozilla-actions/sccache-action@v0.0.10
71+
- uses: jdx/mise-action@v4
72+
- id: zip-release-ci-flow
73+
run: mise run zip-release-ci-flow
74+
env:
75+
TARGET: ${{ matrix.os.target_platform }}
76+
CROSS: ${{ matrix.os.cross }}
77+
- uses: svenstaro/upload-release-action@v2
78+
with:
79+
repo_token: ${{ secrets.GITHUB_TOKEN }}
80+
file: ${{ steps.zip-release-ci-flow.outputs.dist_file_path }}
81+
tag: ${{ steps.zip-release-ci-flow.outputs.dist_version }}
82+
prerelease: false
83+
overwrite: true
84+
- run: ${SCCACHE_PATH} --show-stats
85+
shell: bash
86+
87+
krew-update:
88+
needs: [release, build]
89+
if: needs.release.outputs.releases_created == 'true'
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
with:
94+
ref: ${{ needs.release.outputs.tag }}
95+
- uses: rajatjindal/krew-release-bot@v0.0.51

.github/workflows/release.yaml

Lines changed: 0 additions & 77 deletions
This file was deleted.

.mise.toml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ kind = "0.20"
1616
rust = { version = "1.96.0", profile = "minimal", components = "cargo,rustfmt,clippy" } # the rust tool stack (with cargo, fmt, clippy) to build source
1717
jq = "latest"
1818
"cargo:cross" = "latest"
19+
"github:release-plz/release-plz" = "latest"
20+
"github:orhun/git-cliff" = "latest"
1921

2022
[tasks.clean]
2123
description = "Clean build artifacts"
@@ -103,42 +105,10 @@ if [ -n "$GITHUB_OUTPUT" ]; then
103105
fi
104106
"""
105107

106-
# Documentation tasks
107-
[tasks.update-changelog]
108-
description = "Update changelog using gitmoji-changelog"
109-
run = """
110-
if ! command -v gitmoji-changelog &> /dev/null; then
111-
echo "Installing gitmoji-changelog..."
112-
cargo install gitmoji-changelog
113-
fi
114-
rm -rf CHANGELOG.md
115-
gitmoji-changelog -r x.y.z-dev -o CHANGELOG.md .
116-
"""
117-
118-
[tasks.update-bom]
119-
description = "Update Bill of Materials"
120-
run = """
121-
if ! cargo bom --help &> /dev/null; then
122-
echo "Installing cargo-bom..."
123-
cargo install cargo-bom
124-
fi
125-
cargo bom > BOM.txt
126-
"""
127-
128-
[tasks.update-docs]
129-
description = "Update all documentation"
130-
depends = ["update-changelog", "update-bom"]
131-
132-
[tasks.publish]
133-
description = "Publish to crates.io"
134-
# depends = ["update-docs"]
135-
run = """
136-
if ! command -v cargo-release &> /dev/null; then
137-
echo "Installing cargo-release..."
138-
cargo install cargo-release
139-
fi
140-
cargo release --execute {{option(name="level", default="minor")}}
141-
"""
108+
# Release tasks
109+
[tasks.release-pr]
110+
description = "Create/update release PR via release-plz"
111+
run = "release-plz update"
142112

143113
# Debug task
144114
[tasks.debug]

0 commit comments

Comments
 (0)