Skip to content

Commit e64277a

Browse files
committed
feat: improve skill management and updater release flow
1 parent b1f89f7 commit e64277a

18 files changed

Lines changed: 751 additions & 290 deletions

File tree

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,78 @@
1-
name: Release with Updater
1+
name: Release Updater
22

33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
7+
8+
permissions:
9+
contents: write
710

811
jobs:
912
publish-tauri:
10-
permissions:
11-
contents: write
1213
strategy:
1314
fail-fast: false
1415
matrix:
1516
include:
16-
- platform: 'macos-latest' # for Arm64
17-
args: '--target aarch64-apple-darwin'
18-
- platform: 'windows-latest'
19-
args: ''
17+
- os: macos-latest
18+
target: aarch64-apple-darwin
19+
bundle_name: macos-arm64
20+
- os: macos-15-intel
21+
target: x86_64-apple-darwin
22+
bundle_name: macos-x64
23+
- os: ubuntu-22.04
24+
target: x86_64-unknown-linux-gnu
25+
bundle_name: linux-x64
26+
- os: windows-latest
27+
target: x86_64-pc-windows-msvc
28+
bundle_name: windows-x64
2029

21-
runs-on: ${{ matrix.platform }}
30+
runs-on: ${{ matrix.os }}
2231
steps:
2332
- uses: actions/checkout@v4
2433

25-
- name: setup node
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: "10"
38+
run_install: false
39+
40+
- name: Setup Node.js
2641
uses: actions/setup-node@v4
2742
with:
28-
node-version: lts/*
43+
node-version: "20"
44+
cache: "pnpm"
45+
cache-dependency-path: "pnpm-lock.yaml"
2946

30-
- name: install Rust stable
47+
- name: Install Rust stable
3148
uses: dtolnay/rust-toolchain@stable
3249
with:
33-
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin' || matrix.platform == 'macos-13' && 'x86_64-apple-darwin' || '' }}
50+
targets: ${{ matrix.target }}
3451

35-
- name: install dependencies (ubuntu only)
36-
if: matrix.platform == 'ubuntu-22.04'
52+
- name: Install Linux dependencies
53+
if: matrix.os == 'ubuntu-22.04'
3754
run: |
3855
sudo apt-get update
3956
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
4057
41-
- name: setup pnpm
42-
uses: pnpm/action-setup@v4
43-
with:
44-
version: '10'
45-
run_install: false
46-
47-
- name: install frontend dependencies
58+
- name: Install dependencies
4859
run: pnpm install --frozen-lockfile
4960

50-
- uses: tauri-apps/tauri-action@v0
61+
- name: Build and upload release assets
62+
uses: tauri-apps/tauri-action@v0
5163
env:
5264
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5365
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
5466
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
5567
with:
5668
tagName: ${{ github.ref_name }}
5769
releaseName: 'Skills Manager v__VERSION__'
58-
releaseBody: 'See the assets to download this version and install.'
70+
releaseBody: |
71+
See the assets to download this version and install.
72+
73+
Auto-generated by GitHub Actions.
5974
releaseDraft: false
6075
prerelease: false
61-
includeUpdaterJson: true
62-
args: ${{ matrix.args }}
76+
uploadUpdaterJson: true
77+
uploadUpdaterSignatures: true
78+
args: --target ${{ matrix.target }}

.github/workflows/release.yml

Lines changed: 6 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & Release
1+
name: Prepare Release
22

33
on:
44
workflow_dispatch:
@@ -20,9 +20,6 @@ jobs:
2020
prepare-release:
2121
runs-on: ubuntu-latest
2222
if: github.event_name == 'workflow_dispatch'
23-
outputs:
24-
new_tag: ${{ steps.get_tag.outputs.tag }}
25-
changelog: ${{ steps.extract_changelog.outputs.notes }}
2623
steps:
2724
- name: Checkout code
2825
uses: actions/checkout@v4
@@ -58,183 +55,14 @@ jobs:
5855
run: |
5956
node -e "const fs=require('fs');const pkg=require('./package.json');const path='src-tauri/tauri.conf.json';const conf=JSON.parse(fs.readFileSync(path,'utf8'));conf.version=pkg.version;fs.writeFileSync(path, JSON.stringify(conf,null,2)+'\\n');"
6057
58+
- name: Sync Cargo version
59+
run: |
60+
node -e "const fs=require('fs');const pkg=require('./package.json');const path='src-tauri/Cargo.toml';const content=fs.readFileSync(path,'utf8').replace(/^version = \".*\"$/m, `version = \"${pkg.version}\"`);fs.writeFileSync(path, content);"
61+
6162
- name: Commit and tag
6263
run: |
6364
VERSION=$(node -p "require('./package.json').version")
64-
git add package.json pnpm-lock.yaml CHANGELOG.md src-tauri/tauri.conf.json
65+
git add package.json pnpm-lock.yaml CHANGELOG.md src-tauri/tauri.conf.json src-tauri/Cargo.toml
6566
git commit -m "chore(release): v${VERSION}"
6667
git tag -a "v${VERSION}" -m "v${VERSION}"
6768
git push --follow-tags origin HEAD:main
68-
69-
- name: Get new tag
70-
id: get_tag
71-
run: |
72-
TAG=$(git describe --tags --abbrev=0)
73-
echo "tag=$TAG" >> $GITHUB_OUTPUT
74-
echo "Generated new tag: $TAG"
75-
76-
- name: Extract Changelog
77-
id: extract_changelog
78-
run: |
79-
CHANGELOG_CONTENT=$(node .github/scripts/extract-changelog.js)
80-
echo "notes<<EOF" >> $GITHUB_OUTPUT
81-
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
82-
echo "EOF" >> $GITHUB_OUTPUT
83-
84-
build-mac:
85-
needs: [prepare-release]
86-
strategy:
87-
matrix:
88-
include:
89-
- os: macos-15-intel
90-
arch: x64
91-
- os: macos-latest
92-
arch: arm64
93-
runs-on: ${{ matrix.os }}
94-
steps:
95-
- name: Checkout code
96-
uses: actions/checkout@v4
97-
with:
98-
ref: ${{ needs.prepare-release.outputs.new_tag }}
99-
100-
- name: Setup pnpm
101-
uses: pnpm/action-setup@v4
102-
with:
103-
version: "10"
104-
run_install: false
105-
106-
- name: Setup Node.js
107-
uses: actions/setup-node@v4
108-
with:
109-
node-version: "20"
110-
cache: "pnpm"
111-
cache-dependency-path: "pnpm-lock.yaml"
112-
113-
- name: Setup Rust
114-
uses: dtolnay/rust-toolchain@stable
115-
116-
- name: Install dependencies
117-
run: pnpm install --frozen-lockfile
118-
119-
- name: Build macOS app
120-
run: pnpm tauri build
121-
122-
- name: Rename macOS artifacts
123-
run: |
124-
VERSION=${{ needs.prepare-release.outputs.new_tag }}
125-
VERSION=${VERSION#v}
126-
DMG=$(ls src-tauri/target/release/bundle/dmg/*.dmg | head -n 1)
127-
mv "$DMG" "src-tauri/target/release/bundle/dmg/skills-manager-gui_${VERSION}_macos-${{ matrix.arch }}.dmg"
128-
129-
- name: Upload macOS artifacts
130-
uses: actions/upload-artifact@v4
131-
with:
132-
name: mac-artifacts-${{ matrix.arch }}
133-
path: |
134-
src-tauri/target/release/bundle/dmg/skills-manager-gui_*.dmg
135-
if-no-files-found: error
136-
137-
build-win:
138-
needs: [prepare-release]
139-
runs-on: windows-latest
140-
steps:
141-
- name: Checkout code
142-
uses: actions/checkout@v4
143-
with:
144-
ref: ${{ needs.prepare-release.outputs.new_tag }}
145-
146-
- name: Setup pnpm
147-
uses: pnpm/action-setup@v4
148-
with:
149-
version: "10"
150-
run_install: false
151-
152-
- name: Setup Node.js
153-
uses: actions/setup-node@v4
154-
with:
155-
node-version: "20"
156-
cache: "pnpm"
157-
cache-dependency-path: "pnpm-lock.yaml"
158-
159-
- name: Setup Rust
160-
uses: dtolnay/rust-toolchain@stable
161-
162-
- name: Install dependencies
163-
run: pnpm install --frozen-lockfile
164-
165-
- name: Build Windows app
166-
run: pnpm tauri build
167-
168-
- name: Rename Windows artifacts
169-
shell: pwsh
170-
run: |
171-
$version = "${{ needs.prepare-release.outputs.new_tag }}".TrimStart("v")
172-
$msi = Get-ChildItem "src-tauri/target/release/bundle/msi" -Filter "*.msi" | Select-Object -First 1
173-
if ($msi) {
174-
Rename-Item $msi.FullName (Join-Path $msi.DirectoryName "skills-manager-gui_${version}_windows-x64.msi")
175-
}
176-
$exe = Get-ChildItem "src-tauri/target/release/bundle/nsis" -Filter "*.exe" | Select-Object -First 1
177-
if ($exe) {
178-
Rename-Item $exe.FullName (Join-Path $exe.DirectoryName "skills-manager-gui_${version}_windows-x64-setup.exe")
179-
}
180-
181-
- name: Upload Windows artifacts
182-
uses: actions/upload-artifact@v4
183-
with:
184-
name: win-artifacts
185-
path: |
186-
src-tauri/target/release/bundle/msi/skills-manager-gui_*.msi
187-
src-tauri/target/release/bundle/nsis/skills-manager-gui_*.exe
188-
if-no-files-found: error
189-
190-
release:
191-
needs: [prepare-release, build-mac, build-win]
192-
runs-on: ubuntu-latest
193-
steps:
194-
- name: Download macOS artifacts
195-
uses: actions/download-artifact@v4
196-
with:
197-
pattern: mac-artifacts-*
198-
merge-multiple: true
199-
path: artifacts
200-
201-
- name: Download Windows artifacts
202-
uses: actions/download-artifact@v4
203-
with:
204-
name: win-artifacts
205-
path: artifacts
206-
207-
- name: Create GitHub Release
208-
uses: softprops/action-gh-release@v2
209-
with:
210-
tag_name: ${{ needs.prepare-release.outputs.new_tag }}
211-
draft: false
212-
prerelease: false
213-
files: |
214-
artifacts/**/skills-manager-gui_*.dmg
215-
artifacts/**/skills-manager-gui_*.msi
216-
artifacts/**/skills-manager-gui_*.exe
217-
body: |
218-
## 🎉 新版本发布!
219-
220-
**注意:本项目暂无商业签名证书,安装时可能会提示安全警告。**
221-
222-
### 🍎 macOS 用户
223-
初次安装可能出现 “应用已损坏,无法打开” 或 “来自身份不明的开发者”。
224-
225-
请打开「终端」执行:
226-
227-
```bash
228-
xattr -cr /Applications/skills-manager-gui.app
229-
```
230-
231-
### 🪟 Windows 用户
232-
1. 点击 “更多信息”
233-
2. 点击 “仍要运行”
234-
235-
---
236-
237-
### 更新日志
238-
${{ needs.prepare-release.outputs.changelog }}
239-
env:
240-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)