Skip to content

Commit 88837b7

Browse files
author
linyuan.yang
committed
统一工作流
1 parent 72869a8 commit 88837b7

9 files changed

Lines changed: 102 additions & 113 deletions

File tree

.github/actions/generate-tauri-updater-manifest/index.mjs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,33 @@ function signatureFor(assetName) {
3838
]).trim();
3939
}
4040

41-
function add(keys, candidates) {
41+
function add(platform, candidates) {
4242
const asset = candidates.map((name) => assets.get(name)).find(Boolean);
4343
if (!asset) {
4444
missing.push(candidates.join(' or '));
4545
return;
4646
}
47-
const entry = {
47+
platforms[platform] = {
4848
signature: signatureFor(asset.name),
4949
url: asset.browser_download_url,
5050
};
51-
for (const key of keys) {
52-
platforms[key] = entry;
53-
}
5451
}
5552

56-
add(['darwin-x86_64', 'darwin-x86_64-app'], [
57-
`${prefix}_${version}_macos_x64.app.tar.gz`,
53+
add('darwin-x86_64', [
54+
`${prefix}_${version}_macos_universal.app.tar.gz`,
5855
]);
59-
add(['darwin-aarch64', 'darwin-aarch64-app'], [
60-
`${prefix}_${version}_macos_arm64.app.tar.gz`,
56+
add('darwin-aarch64', [
57+
`${prefix}_${version}_macos_universal.app.tar.gz`,
6158
]);
62-
add(['windows-x86_64', 'windows-x86_64-nsis'], [
59+
add('windows-x86_64', [
6360
`${prefix}_${version}_windows_x64.nsis.zip`,
6461
`${prefix}_${version}_windows_x64.exe`,
6562
]);
66-
add(['windows-aarch64', 'windows-aarch64-nsis'], [
63+
add('windows-aarch64', [
6764
`${prefix}_${version}_windows_arm64.nsis.zip`,
6865
`${prefix}_${version}_windows_arm64.exe`,
6966
]);
70-
add(['linux-x86_64', 'linux-x86_64-appimage'], [
67+
add('linux-x86_64', [
7168
`${prefix}_${version}_linux_x64.AppImage.tar.gz`,
7269
`${prefix}_${version}_linux_x64.AppImage`,
7370
]);
@@ -86,10 +83,16 @@ fs.writeFileSync(
8683
}, null, 2)}\n`,
8784
);
8885

86+
let updaterReleaseExists = true;
8987
try {
9088
gh(['release', 'view', updaterRelease, '-R', repo], { stdio: ['ignore', 'ignore', 'ignore'] });
91-
gh(['release', 'upload', updaterRelease, outputName, '-R', repo, '--clobber']);
9289
} catch {
90+
updaterReleaseExists = false;
91+
}
92+
93+
if (updaterReleaseExists) {
94+
gh(['release', 'upload', updaterRelease, outputName, '-R', repo, '--clobber']);
95+
} else {
9396
gh([
9497
'release', 'create', updaterRelease,
9598
'-R', repo,

.github/actions/rename-tauri-assets/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ name: Rename Tauri assets
22
description: Rename Tauri desktop release assets to include OS and architecture tags.
33
inputs:
44
product-prefix:
5-
description: Product prefix used in Tauri artifact names, for example sbot, STerm, or sbox.
5+
description: Public product prefix used for normalized release assets.
66
required: true
7+
source-product-name:
8+
description: Tauri productName used by the original assets. Defaults to product-prefix.
9+
required: false
10+
default: ''
711
version:
812
description: Release version.
913
required: true
@@ -20,6 +24,7 @@ runs:
2024
- shell: bash
2125
env:
2226
INPUT_PRODUCT_PREFIX: ${{ inputs.product-prefix }}
27+
INPUT_SOURCE_PRODUCT_NAME: ${{ inputs.source-product-name }}
2328
INPUT_VERSION: ${{ inputs.version }}
2429
INPUT_TAG: ${{ inputs.tag }}
2530
INPUT_REPO: ${{ inputs.repo }}
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { execFileSync } from 'node:child_process';
22

33
const prefix = process.env.INPUT_PRODUCT_PREFIX;
4+
const sourceProductName = process.env.INPUT_SOURCE_PRODUCT_NAME || prefix;
45
const version = process.env.INPUT_VERSION;
56
const tag = process.env.INPUT_TAG;
67
const repo = process.env.INPUT_REPO || process.env.GITHUB_REPOSITORY;
@@ -13,19 +14,17 @@ function escapeRegExp(value) {
1314
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1415
}
1516

16-
const escaped = escapeRegExp(prefix);
17-
const versionPattern = '[0-9][0-9.]*';
17+
const escaped = escapeRegExp(sourceProductName);
18+
const versionPattern = escapeRegExp(version);
1819
const replacements = [
19-
[new RegExp(`^${escaped}_${versionPattern}_aarch64\\.dmg$`), `${prefix}_${version}_macos_arm64.dmg`],
20-
[new RegExp(`^${escaped}_${versionPattern}_x64\\.dmg$`), `${prefix}_${version}_macos_x64.dmg`],
21-
[new RegExp(`^${escaped}_aarch64\\.app\\.tar\\.gz(\\.sig)?$`), `${prefix}_${version}_macos_arm64.app.tar.gz$1`],
22-
[new RegExp(`^${escaped}_x64\\.app\\.tar\\.gz(\\.sig)?$`), `${prefix}_${version}_macos_x64.app.tar.gz$1`],
23-
[new RegExp(`^${escaped}_${versionPattern}_amd64\.AppImage\.tar\.gz(\.sig)?$`), `${prefix}_${version}_linux_x64.AppImage.tar.gz$1`],
24-
[new RegExp(`^${escaped}_${versionPattern}_amd64\.(AppImage|deb)(\.sig)?$`), `${prefix}_${version}_linux_x64.$1$2`],
25-
[new RegExp(`^${escaped}_${versionPattern}_x64-setup\\.nsis\\.zip(\\.sig)?$`), `${prefix}_${version}_windows_x64.nsis.zip$1`],
26-
[new RegExp(`^${escaped}_${versionPattern}_arm64-setup\\.nsis\\.zip(\\.sig)?$`), `${prefix}_${version}_windows_arm64.nsis.zip$1`],
27-
[new RegExp(`^${escaped}_${versionPattern}_x64-setup\\.exe(\\.sig)?$`), `${prefix}_${version}_windows_x64.exe$1`],
28-
[new RegExp(`^${escaped}_${versionPattern}_arm64-setup\\.exe(\\.sig)?$`), `${prefix}_${version}_windows_arm64.exe$1`],
20+
[new RegExp(`^${escaped}_${versionPattern}_universal\\.dmg$`, 'i'), `${prefix}_${version}_macos_universal.dmg`],
21+
[new RegExp(`^${escaped}_universal\\.app\\.tar\\.gz(\\.sig)?$`, 'i'), `${prefix}_${version}_macos_universal.app.tar.gz$1`],
22+
[new RegExp(`^${escaped}_${versionPattern}_amd64\.AppImage\.tar\.gz(\.sig)?$`, 'i'), `${prefix}_${version}_linux_x64.AppImage.tar.gz$1`],
23+
[new RegExp(`^${escaped}_${versionPattern}_amd64\.(AppImage|deb)(\.sig)?$`, 'i'), `${prefix}_${version}_linux_x64.$1$2`],
24+
[new RegExp(`^${escaped}_${versionPattern}_x64-setup\\.nsis\\.zip(\\.sig)?$`, 'i'), `${prefix}_${version}_windows_x64.nsis.zip$1`],
25+
[new RegExp(`^${escaped}_${versionPattern}_arm64-setup\\.nsis\\.zip(\\.sig)?$`, 'i'), `${prefix}_${version}_windows_arm64.nsis.zip$1`],
26+
[new RegExp(`^${escaped}_${versionPattern}_x64-setup\\.exe(\\.sig)?$`, 'i'), `${prefix}_${version}_windows_x64.exe$1`],
27+
[new RegExp(`^${escaped}_${versionPattern}_arm64-setup\\.exe(\\.sig)?$`, 'i'), `${prefix}_${version}_windows_arm64.exe$1`],
2928
];
3029

3130
const release = JSON.parse(gh(['api', `/repos/${repo}/releases/tags/${tag}`]));
@@ -39,5 +38,3 @@ for (const asset of release.assets || []) {
3938
gh(['api', '-X', 'PATCH', `/repos/${repo}/releases/assets/${asset.id}`, '-f', `name=${nextName}`]);
4039
}
4140
}
42-
43-
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Setup Node and pnpm
2+
description: Set up the shared Node.js and pnpm toolchain for release jobs.
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: pnpm/action-setup@v6
7+
with:
8+
version: 10.33.0
9+
10+
- uses: actions/setup-node@v5
11+
with:
12+
node-version: 24
13+
cache: pnpm
14+
registry-url: https://registry.npmjs.org

.github/workflows/tauri-android-release.yml

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
cargo-target-path:
1313
required: true
1414
type: string
15-
cache-key-prefix:
16-
required: false
17-
type: string
18-
default: android-cargo-app
1915
tag-name:
2016
required: true
2117
type: string
@@ -36,26 +32,6 @@ on:
3632
required: false
3733
type: string
3834
default: ''
39-
node-version:
40-
required: false
41-
type: string
42-
default: '24'
43-
pnpm-version:
44-
required: false
45-
type: string
46-
default: 10.33.0
47-
android-api:
48-
required: false
49-
type: string
50-
default: '36'
51-
android-build-tools:
52-
required: false
53-
type: string
54-
default: 36.0.0
55-
android-ndk-version:
56-
required: false
57-
type: string
58-
default: 27.0.11902837
5935

6036
jobs:
6137
check-signing:
@@ -94,11 +70,11 @@ jobs:
9470

9571
- uses: pnpm/action-setup@v6
9672
with:
97-
version: ${{ inputs.pnpm-version }}
73+
version: 10.33.0
9874

9975
- uses: actions/setup-node@v5
10076
with:
101-
node-version: ${{ inputs.node-version }}
77+
node-version: 24
10278
cache: pnpm
10379

10480
- uses: actions/setup-java@v4
@@ -111,8 +87,8 @@ jobs:
11187

11288
- name: Install Android SDK packages
11389
run: |
114-
sdkmanager "platform-tools" "platforms;android-${{ inputs.android-api }}" "build-tools;${{ inputs.android-build-tools }}" "ndk;${{ inputs.android-ndk-version }}"
115-
echo "NDK_HOME=$ANDROID_HOME/ndk/${{ inputs.android-ndk-version }}" >> "$GITHUB_ENV"
90+
sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0" "ndk;27.0.11902837"
91+
echo "NDK_HOME=$ANDROID_HOME/ndk/27.0.11902837" >> "$GITHUB_ENV"
11692
11793
- name: Install Rust
11894
uses: dtolnay/rust-toolchain@stable
@@ -126,9 +102,9 @@ jobs:
126102
~/.cargo/registry
127103
~/.cargo/git
128104
${{ inputs.cargo-target-path }}
129-
key: ${{ inputs.cache-key-prefix }}-${{ hashFiles(inputs.cargo-lock-path) }}
105+
key: android-cargo-${{ hashFiles(inputs.cargo-lock-path) }}
130106
restore-keys: |
131-
${{ inputs.cache-key-prefix }}-
107+
android-cargo-
132108
133109
- run: pnpm install --frozen-lockfile
134110

.github/workflows/tauri-desktop-release.yml

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
cargo-target-path:
1313
required: true
1414
type: string
15-
cache-key-prefix:
16-
required: false
17-
type: string
18-
default: cargo-app
1915
tag-name:
2016
required: true
2117
type: string
@@ -46,41 +42,38 @@ on:
4642
required: false
4743
type: boolean
4844
default: false
49-
matrix-json:
50-
required: false
51-
type: string
52-
default: >-
53-
[{"platform":"macos-latest","args":"--target aarch64-apple-darwin","rust-target":"aarch64-apple-darwin"},{"platform":"macos-latest","args":"--target x86_64-apple-darwin","rust-target":"x86_64-apple-darwin"},{"platform":"ubuntu-22.04","args":"","rust-target":""},{"platform":"windows-latest","args":"","rust-target":""},{"platform":"windows-latest","args":"--target aarch64-pc-windows-msvc","rust-target":"aarch64-pc-windows-msvc"}]
54-
linux-packages:
55-
required: false
56-
type: string
57-
default: libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
58-
node-version:
59-
required: false
60-
type: string
61-
default: '24'
62-
pnpm-version:
63-
required: false
64-
type: string
65-
default: 10.33.0
6645

6746
jobs:
6847
release-desktop:
48+
timeout-minutes: 60
6949
strategy:
7050
fail-fast: false
7151
matrix:
72-
include: ${{ fromJSON(inputs.matrix-json) }}
52+
include:
53+
- platform: macos-26
54+
args: --target universal-apple-darwin
55+
rust-target: aarch64-apple-darwin,x86_64-apple-darwin
56+
cache-key: universal-apple-darwin
57+
- platform: ubuntu-24.04
58+
args: ''
59+
rust-target: ''
60+
- platform: windows-latest
61+
args: ''
62+
rust-target: ''
63+
- platform: windows-latest
64+
args: --target aarch64-pc-windows-msvc
65+
rust-target: aarch64-pc-windows-msvc
7366
runs-on: ${{ matrix.platform }}
7467
steps:
7568
- uses: actions/checkout@v5
7669

7770
- uses: pnpm/action-setup@v6
7871
with:
79-
version: ${{ inputs.pnpm-version }}
72+
version: 10.33.0
8073

8174
- uses: actions/setup-node@v5
8275
with:
83-
node-version: ${{ inputs.node-version }}
76+
node-version: 24
8477
cache: pnpm
8578

8679
- name: Install Rust
@@ -95,19 +88,30 @@ jobs:
9588
~/.cargo/registry
9689
~/.cargo/git
9790
${{ inputs.cargo-target-path }}
98-
key: ${{ matrix.platform }}-${{ matrix.rust-target || 'default' }}-${{ inputs.cache-key-prefix }}-${{ hashFiles(inputs.cargo-lock-path) }}
91+
key: ${{ matrix.platform }}-${{ matrix.cache-key || matrix.rust-target || 'default' }}-cargo-${{ hashFiles(inputs.cargo-lock-path) }}
9992
restore-keys: |
100-
${{ matrix.platform }}-${{ matrix.rust-target || 'default' }}-${{ inputs.cache-key-prefix }}-
101-
${{ matrix.platform }}-${{ inputs.cache-key-prefix }}-
93+
${{ matrix.platform }}-${{ matrix.cache-key || matrix.rust-target || 'default' }}-cargo-
94+
${{ matrix.platform }}-cargo-
10295
10396
- name: Install Linux deps
10497
if: startsWith(matrix.platform, 'ubuntu-')
10598
run: |
10699
sudo apt-get update
107-
sudo apt-get install -y ${{ inputs.linux-packages }}
100+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libpipewire-0.3-dev libgbm-dev patchelf
108101
109102
- run: pnpm install --frozen-lockfile
110103

104+
- name: Import macOS signing certificate
105+
if: startsWith(matrix.platform, 'macos-')
106+
shell: bash
107+
env:
108+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
109+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
110+
run: |
111+
if [ -f scripts/mac-import-signing-cert.sh ]; then
112+
bash -- scripts/mac-import-signing-cert.sh
113+
fi
114+
111115
- uses: tauri-apps/tauri-action@v0
112116
env:
113117
GITHUB_TOKEN: ${{ secrets.PUBLIC_RELEASE_TOKEN || secrets.GITHUB_TOKEN }}

.github/workflows/tauri-ios-unsigned.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
cargo-target-path:
1313
required: true
1414
type: string
15-
cache-key-prefix:
16-
required: false
17-
type: string
18-
default: ios-cargo-app
1915
tag-name:
2016
required: true
2117
type: string
@@ -36,43 +32,27 @@ on:
3632
build-command:
3733
required: true
3834
type: string
39-
node-version:
40-
required: false
41-
type: string
42-
default: '24'
43-
pnpm-version:
44-
required: false
45-
type: string
46-
default: 10.33.0
47-
runner:
48-
required: false
49-
type: string
50-
default: macos-15
51-
xcode-developer-dir:
52-
required: false
53-
type: string
54-
default: /Applications/Xcode_16.3.app/Contents/Developer
5535

5636
jobs:
5737
release-ios:
58-
runs-on: ${{ inputs.runner }}
38+
runs-on: macos-15
5939
steps:
6040
- uses: actions/checkout@v5
6141

6242
- uses: pnpm/action-setup@v6
6343
with:
64-
version: ${{ inputs.pnpm-version }}
44+
version: 10.33.0
6545

6646
- uses: actions/setup-node@v5
6747
with:
68-
node-version: ${{ inputs.node-version }}
48+
node-version: 24
6949
cache: pnpm
7050

7151
- name: Select Xcode
7252
shell: bash
7353
run: |
74-
if [ -n "${{ inputs.xcode-developer-dir }}" ] && [ -d "${{ inputs.xcode-developer-dir }}" ]; then
75-
export DEVELOPER_DIR="${{ inputs.xcode-developer-dir }}"
54+
if [ -d "/Applications/Xcode_16.3.app/Contents/Developer" ]; then
55+
export DEVELOPER_DIR="/Applications/Xcode_16.3.app/Contents/Developer"
7656
echo "DEVELOPER_DIR=$DEVELOPER_DIR" >> "$GITHUB_ENV"
7757
fi
7858
xcodebuild -version
@@ -89,9 +69,9 @@ jobs:
8969
~/.cargo/registry
9070
~/.cargo/git
9171
${{ inputs.cargo-target-path }}
92-
key: ${{ inputs.cache-key-prefix }}-${{ hashFiles(inputs.cargo-lock-path) }}
72+
key: ios-cargo-${{ hashFiles(inputs.cargo-lock-path) }}
9373
restore-keys: |
94-
${{ inputs.cache-key-prefix }}-
74+
ios-cargo-
9575
9676
- run: pnpm install --frozen-lockfile
9777

0 commit comments

Comments
 (0)