Skip to content

Commit bc5af45

Browse files
MarkShawn2020claude
andcommitted
ci: 配置 changeset + GitHub Actions release 流程
- 添加 packageManager 字段 (pnpm@10.18.1) - 初始化 changeset 配置 - 创建 Tauri 多平台构建 workflow - 支持自动创建 Version PR 和 GitHub Release 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8567c7c commit bc5af45

5 files changed

Lines changed: 975 additions & 36 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/release.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['v*']
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to build (e.g., v0.1.0)'
11+
required: true
12+
13+
env:
14+
CARGO_INCREMENTAL: 0
15+
16+
jobs:
17+
release:
18+
if: github.ref == 'refs/heads/main'
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- uses: pnpm/action-setup@v4
29+
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: pnpm
34+
35+
- run: pnpm install
36+
37+
- name: Create Release Pull Request
38+
id: changesets
39+
uses: changesets/action@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Push tag if version changed
44+
if: steps.changesets.outputs.hasChangesets == 'false'
45+
shell: bash
46+
run: |
47+
VERSION=$(node -p "require('./package.json').version")
48+
if ! git ls-remote --tags origin | grep -q "refs/tags/v$VERSION$"; then
49+
git config user.name "github-actions[bot]"
50+
git config user.email "github-actions[bot]@users.noreply.github.com"
51+
git tag "v$VERSION"
52+
git push origin "v$VERSION"
53+
echo "Pushed tag v$VERSION"
54+
else
55+
echo "Tag v$VERSION already exists"
56+
fi
57+
58+
build:
59+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
include:
64+
- os: ubuntu-24.04
65+
target: x86_64-unknown-linux-gnu
66+
- os: macos-latest
67+
target: x86_64-apple-darwin
68+
- os: macos-latest
69+
target: aarch64-apple-darwin
70+
- os: windows-latest
71+
target: x86_64-pc-windows-msvc
72+
runs-on: ${{ matrix.os }}
73+
permissions:
74+
contents: write
75+
steps:
76+
- uses: actions/checkout@v4
77+
with:
78+
ref: ${{ github.event.inputs.tag || github.ref }}
79+
80+
- name: Install Linux dependencies
81+
if: runner.os == 'Linux'
82+
run: |
83+
sudo apt-get update
84+
sudo apt-get install -y \
85+
libwebkit2gtk-4.1-dev \
86+
libappindicator3-dev \
87+
librsvg2-dev \
88+
patchelf \
89+
libpipewire-0.3-dev \
90+
libgbm-dev \
91+
libxcb1-dev \
92+
libegl-dev
93+
94+
- uses: pnpm/action-setup@v4
95+
96+
- uses: actions/setup-node@v4
97+
with:
98+
node-version: 20
99+
cache: pnpm
100+
101+
- uses: dtolnay/rust-toolchain@stable
102+
with:
103+
targets: ${{ matrix.target }}
104+
105+
- uses: Swatinem/rust-cache@v2
106+
with:
107+
workspaces: src-tauri
108+
109+
- run: pnpm install
110+
111+
- name: Get tag name
112+
id: tag
113+
shell: bash
114+
run: |
115+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
116+
echo "name=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
117+
else
118+
echo "name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
119+
fi
120+
121+
- uses: tauri-apps/tauri-action@v0
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
with:
125+
tagName: ${{ steps.tag.outputs.name }}
126+
releaseName: ${{ steps.tag.outputs.name }}
127+
releaseBody: "See [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details."
128+
releaseDraft: false
129+
prerelease: false
130+
args: --target ${{ matrix.target }}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"private": true,
44
"version": "0.4.0",
55
"type": "module",
6+
"packageManager": "pnpm@10.18.1",
67
"scripts": {
78
"dev": "vite",
89
"build": "tsc && vite build",
@@ -24,11 +25,12 @@
2425
"tailwindcss": "^4.1.17"
2526
},
2627
"devDependencies": {
28+
"@changesets/cli": "^2.29.8",
2729
"@tauri-apps/cli": "^2",
2830
"@types/react": "^19.1.8",
2931
"@types/react-dom": "^19.1.6",
3032
"@vitejs/plugin-react": "^4.6.0",
31-
"lovinsp": "^1.4.13",
33+
"lovinsp": "^1.4.14",
3234
"typescript": "~5.8.3",
3335
"vite": "^7.0.4"
3436
}

0 commit comments

Comments
 (0)