Skip to content

Commit 89a2e40

Browse files
committed
feat: add workflow
1 parent b1ce11c commit 89a2e40

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Publish desktop app
2+
# on:
3+
# pull_request:
4+
# types: [closed]
5+
6+
on:
7+
push:
8+
branches:
9+
- '**' # 匹配所有分支
10+
11+
jobs:
12+
publish:
13+
permissions:
14+
contents: write
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- platform: 'macos-latest' # for Arm based macs (M1 and above).
20+
args: '--target aarch64-apple-darwin'
21+
- platform: 'macos-latest' # for Intel based macs.
22+
args: '--target x86_64-apple-darwin'
23+
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04.
24+
args: ''
25+
- platform: 'windows-latest'
26+
args: ''
27+
28+
runs-on: ubuntu-latest
29+
# 当具有 release 标签的 PR 被合并时,自动发布包版本
30+
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.merged == true
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- name: Install Node.js
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: 18
39+
40+
- name: install Rust stable
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
44+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
45+
46+
- name: install dependencies (ubuntu only)
47+
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
51+
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
52+
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
53+
54+
- name: Install pnpm
55+
uses: pnpm/action-setup@v4
56+
with:
57+
run_install: false
58+
59+
- name: Cache pnpm modules
60+
uses: actions/cache@v3
61+
with:
62+
path: |
63+
.pnpm-store
64+
node_modules
65+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
66+
restore-keys: |
67+
${{ runner.os }}-pnpm-
68+
69+
- name: Install dependencies
70+
run: pnpm install
71+
72+
- name: build front-end assets
73+
run: npm run build:portal:desktop
74+
75+
- uses: tauri-apps/tauri-action@v0
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
80+
releaseName: 'App v__VERSION__'
81+
releaseBody: 'See the assets to download this version and install.'
82+
releaseDraft: true
83+
prerelease: false
84+
args: ${{ matrix.args }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"start": "turbo run start",
1010
"build": "turbo run build --no-cache",
1111
"build:portal": "npm run build && cd packages/studio-website && npm run build:site",
12+
"build:portal:desktop": "npm run build && cd packages/studio-website && npm run build:desktop-app",
1213
"build:portal:single": "npm run build && cd packages/studio-website && npm run build:site:single",
1314
"build:docs:interactive": "npm run build && cd docs/interactive && npm run build:site",
1415
"build:docs:portal": "npm run build && dumi build",

packages/studio-website/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"start": "vite dev",
1717
"build:site:single": "vite build --mode=single",
1818
"build:site:less": "vite build --mode=less",
19-
"build:site": "vite build"
19+
"build:site": "vite build",
20+
"build:desktop-app": "pnpm tauri build"
2021
},
2122
"publishConfig": {
2223
"access": "public",

0 commit comments

Comments
 (0)