Skip to content

Commit 79e5d9a

Browse files
committed
chore: move from release-plz to git cliff
1 parent 226c90e commit 79e5d9a

File tree

6 files changed

+212
-316
lines changed

6 files changed

+212
-316
lines changed

.github/workflows/release-plz.yml

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

.github/workflows/release.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
release:
13+
name: Build & Release
14+
runs-on: windows-latest
15+
if: github.repository_owner == 'LeagueToolkit'
16+
permissions:
17+
contents: write
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Extract version from tag
25+
id: version
26+
shell: bash
27+
run: |
28+
TAG="${GITHUB_REF#refs/tags/}"
29+
VERSION="${TAG#v}"
30+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
31+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
32+
33+
if [[ "$VERSION" == *-* ]]; then
34+
echo "prerelease=true" >> "$GITHUB_OUTPUT"
35+
else
36+
echo "prerelease=false" >> "$GITHUB_OUTPUT"
37+
fi
38+
39+
- name: Validate version consistency
40+
shell: bash
41+
run: |
42+
CARGO_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' src-tauri/Cargo.toml | head -1)
43+
if [ "$CARGO_VERSION" != "${{ steps.version.outputs.version }}" ]; then
44+
echo "::error::Tag version (${{ steps.version.outputs.version }}) does not match Cargo.toml version ($CARGO_VERSION)"
45+
exit 1
46+
fi
47+
48+
- name: Generate changelog
49+
id: changelog
50+
uses: orhun/git-cliff-action@v4
51+
with:
52+
config: cliff.toml
53+
args: --latest --strip header
54+
55+
- name: Setup Node.js
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: "22"
59+
60+
- uses: pnpm/action-setup@v4
61+
62+
- name: Install Rust toolchain
63+
uses: dtolnay/rust-toolchain@stable
64+
with:
65+
targets: x86_64-pc-windows-msvc
66+
67+
- uses: Swatinem/rust-cache@v2
68+
69+
- name: Install frontend dependencies
70+
run: pnpm install --frozen-lockfile
71+
72+
- name: Patch tauri.conf.json
73+
shell: bash
74+
run: |
75+
cd src-tauri
76+
# Set version from tag
77+
CONF=$(cat tauri.conf.json)
78+
CONF=$(echo "$CONF" | jq --arg v "${{ steps.version.outputs.version }}" '.version = $v')
79+
80+
# For pre-releases, restrict to NSIS only (MSI doesn't support non-numeric pre-release identifiers)
81+
if [ "${{ steps.version.outputs.prerelease }}" = "true" ]; then
82+
CONF=$(echo "$CONF" | jq '.bundle.targets = ["nsis"]')
83+
fi
84+
85+
echo "$CONF" > tauri.conf.json
86+
87+
- name: Build and release
88+
uses: tauri-apps/tauri-action@v0
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
92+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
93+
with:
94+
tagName: ${{ steps.version.outputs.tag }}
95+
releaseName: "LTK Manager v${{ steps.version.outputs.version }}"
96+
releaseBody: ${{ steps.changelog.outputs.content }}
97+
releaseDraft: false
98+
prerelease: ${{ steps.version.outputs.prerelease }}
99+
updaterJsonPreferNsis: true
100+
101+
- name: Update updater release
102+
shell: bash
103+
run: |
104+
TAG="${{ steps.version.outputs.tag }}"
105+
106+
# Download latest.json from the release we just created
107+
gh release download "$TAG" --pattern "latest.json" --dir . --clobber
108+
109+
# Upload to the pinned "updater" release
110+
if gh release view updater &>/dev/null; then
111+
gh release upload updater latest.json --clobber
112+
else
113+
gh release create updater latest.json \
114+
--title "Updater" \
115+
--notes "Auto-updated by CI. Contains the latest updater manifest for in-app updates." \
116+
--latest=false
117+
fi
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
[workspace]
2-
release_always = false
3-
changelog_update = true
4-
git_tag_enable = true
5-
git_release_enable = true
6-
git_tag_name = "v{{ version }}"
7-
git_release_name = "LTK Manager v{{ version }}"
8-
git_release_body = "{{ changelog }}"
9-
git_release_type = "auto"
10-
11-
[[package]]
12-
name = "ltk-manager"
13-
publish = false
14-
publish_no_verify = true
15-
git_only = true
16-
semver_check = false
17-
changelog_update = true
18-
191
[changelog]
202
header = """
213
# Changelog
@@ -26,8 +8,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
268
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
279
2810
"""
29-
tag_pattern = "v[0-9].*"
30-
sort_commits = "newest"
11+
body = """
12+
{%- macro remote_url() -%}
13+
https://github.com/LeagueToolkit/ltk-manager
14+
{%- endmacro -%}
15+
16+
{% if version -%}
17+
## [{{ version | trim_start_matches(pat="v") }}]({{ self::remote_url() }}/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
18+
{% else -%}
19+
## [Unreleased]
20+
{% endif -%}
21+
22+
{% for group, commits in commits | group_by(attribute="group") %}
23+
### {{ group | striptags | trim | upper_first }}
24+
{% for commit in commits %}
25+
- {{ commit.message | split(pat="\n") | first | trim }}
26+
{%- endfor %}
27+
{% endfor %}
28+
"""
29+
footer = ""
30+
trim = true
31+
postprocessors = []
32+
33+
[git]
34+
conventional_commits = true
35+
filter_unconventional = false
36+
split_commits = false
3137
commit_parsers = [
3238
{ message = "^chore: release", skip = true },
3339
{ message = "^chore: bump version", skip = true },
@@ -40,3 +46,5 @@ commit_parsers = [
4046
{ message = "^docs", group = "Documentation" },
4147
{ message = ".*", group = "Other" },
4248
]
49+
tag_pattern = "v[0-9].*"
50+
sort_commits = "newest"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"format": "prettier --write .",
1515
"format:check": "prettier --check .",
1616
"check": "npm run typecheck && npm run lint && npm run format:check",
17+
"release": "bash scripts/release.sh",
1718
"prepare": "husky"
1819
},
1920
"lint-staged": {

0 commit comments

Comments
 (0)