Skip to content

Commit ecef17a

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 ecef17a

8 files changed

Lines changed: 178 additions & 2287 deletions

File tree

.github/workflows/release-plz.yaml

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