Skip to content

Commit ea9de7a

Browse files
committed
ci: add manual desktop test builds
1 parent e3c2c00 commit ea9de7a

1 file changed

Lines changed: 157 additions & 0 deletions

File tree

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Build Desktop Test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Branch, tag, or commit to build."
8+
required: false
9+
default: main
10+
type: string
11+
platform:
12+
description: "Platform to build."
13+
required: false
14+
default: all
15+
type: choice
16+
options:
17+
- all
18+
- macos
19+
- windows
20+
mac_signing:
21+
description: "macOS signing mode."
22+
required: false
23+
default: developer-id-skip-stapling
24+
type: choice
25+
options:
26+
- developer-id-skip-stapling
27+
- developer-id-notarized
28+
- adhoc
29+
- unsigned
30+
31+
permissions:
32+
contents: read
33+
34+
env:
35+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
36+
37+
jobs:
38+
build:
39+
name: build-test (${{ matrix.id }})
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
include:
44+
- id: macos-universal
45+
platform: macos-latest
46+
args: --target universal-apple-darwin
47+
bundle_dir: src-tauri/target/universal-apple-darwin/release/bundle
48+
enabled_input: macos
49+
- id: windows-x86_64
50+
platform: windows-latest
51+
args: ""
52+
bundle_dir: src-tauri/target/release/bundle
53+
enabled_input: windows
54+
55+
if: ${{ inputs.platform == 'all' || inputs.platform == matrix.enabled_input }}
56+
runs-on: ${{ matrix.platform }}
57+
env:
58+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
59+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
60+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
61+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
62+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
63+
APPLE_ID: ${{ secrets.APPLE_ID }}
64+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
65+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
66+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
with:
72+
ref: ${{ inputs.ref }}
73+
74+
- name: Setup pnpm
75+
uses: pnpm/action-setup@v4
76+
with:
77+
version: 10.23.0
78+
79+
- name: Setup Node
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: 22
83+
cache: pnpm
84+
85+
- name: Install Rust
86+
uses: dtolnay/rust-toolchain@stable
87+
with:
88+
targets: ${{ startsWith(matrix.id, 'macos-') && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
89+
90+
- name: Cache Rust build
91+
uses: actions/cache@v4
92+
with:
93+
path: |
94+
~/.cargo/registry
95+
~/.cargo/git
96+
src-tauri/target
97+
key: test-rust-${{ runner.os }}-${{ matrix.id }}-${{ hashFiles('src-tauri/Cargo.lock') }}
98+
restore-keys: |
99+
test-rust-${{ runner.os }}-${{ matrix.id }}-
100+
rust-${{ runner.os }}-${{ matrix.id }}-
101+
rust-${{ runner.os }}-
102+
103+
- name: Install dependencies
104+
run: pnpm install --frozen-lockfile
105+
106+
- name: Import Apple signing certificate
107+
if: startsWith(matrix.id, 'macos-') && startsWith(inputs.mac_signing, 'developer-id')
108+
shell: bash
109+
run: |
110+
certificate_path="$RUNNER_TEMP/apple-certificate.p12"
111+
keychain_path="$RUNNER_TEMP/apple-signing.keychain-db"
112+
echo "$APPLE_CERTIFICATE" | base64 --decode > "$certificate_path"
113+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path"
114+
security set-keychain-settings -lut 21600 "$keychain_path"
115+
security default-keychain -s "$keychain_path"
116+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$keychain_path"
117+
security import "$certificate_path" -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign -k "$keychain_path"
118+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$keychain_path"
119+
security list-keychains -d user -s "$keychain_path" $(security list-keychains -d user | sed 's/[\" ]//g')
120+
security find-identity -v -p codesigning "$keychain_path"
121+
122+
- name: Build desktop bundle
123+
shell: bash
124+
run: |
125+
extra_args=()
126+
if [[ "${{ matrix.id }}" == macos-* ]]; then
127+
case "${{ inputs.mac_signing }}" in
128+
developer-id-skip-stapling)
129+
extra_args+=(--skip-stapling)
130+
;;
131+
developer-id-notarized)
132+
;;
133+
adhoc)
134+
unset APPLE_CERTIFICATE APPLE_CERTIFICATE_PASSWORD APPLE_SIGNING_IDENTITY APPLE_ID APPLE_PASSWORD APPLE_TEAM_ID KEYCHAIN_PASSWORD
135+
extra_args+=(--config '{"bundle":{"macOS":{"signingIdentity":"-","hardenedRuntime":false}}}')
136+
;;
137+
unsigned)
138+
extra_args+=(--no-sign)
139+
;;
140+
esac
141+
fi
142+
pnpm tauri build ${{ matrix.args }} "${extra_args[@]}"
143+
144+
- name: Stage bundle artifacts
145+
shell: bash
146+
env:
147+
BUNDLE_SOURCE_DIR: ${{ matrix.bundle_dir }}
148+
RELEASE_BUILD_ID: ${{ matrix.id }}-test
149+
RELEASE_STAGE_DIR: release-artifacts
150+
run: node scripts/release/stage-bundle-artifacts.mjs
151+
152+
- name: Upload bundle artifacts
153+
uses: actions/upload-artifact@v4
154+
with:
155+
name: test-bundle-${{ matrix.id }}
156+
path: release-artifacts/${{ matrix.id }}-test/*
157+
if-no-files-found: error

0 commit comments

Comments
 (0)