Repository navigation
254 lines (230 loc) · 9.69 KB
/
Copy pathbundle.yml
File metadata and controls
254 lines (230 loc) · 9.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: Bundle
run-name: Workshop bundles (${{ github.event_name == 'pull_request' && 'pull request' || 'dispatched' }})
# Builds Workshop's Tauri bundle for the five targets (Windows x64, macOS
# ARM and Intel, Linux x64 and ARM64) with `cargo workshop bundle`.
# cppalliance/runvil builds each platform's installer from such a bundle,
# installs it on a fresh machine of that kind, and publishes the release;
# nothing here is installed or published.
#
# Every build runs with --sign. The key is a run key that prepare generates
# and nothing trusts, so this workflow reads no secret.
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/bundle.yml
- Cargo.toml
- Cargo.lock
- crates/build-workshop/**
- crates/workshop/desktop/installer.nsi
- crates/workshop/desktop/build.rs
- crates/workshop/desktop/src/gateway/**
- crates/workshop/desktop/*.plist
- crates/workshop/desktop/tauri*.conf.json
- crates/workshop/desktop/icons/**
- crates/workshop/plugin-std/**
- crates/workshop/plugin-bashkit/**
- crates/workshop/package.json
- crates/workshop/package-lock.json
- crates/workshop/gateway-discovery/src/**
- gateway-pin/**
- tools/**
permissions:
contents: read
concurrency:
group: bundle-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
execution-sha: ${{ steps.identity.outputs.sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Report the execution identity
id: identity
shell: bash
run: |
set -euo pipefail
sha=$(git rev-parse HEAD)
[ "$sha" = "$GITHUB_SHA" ] || { echo "checkout $sha does not match event SHA $GITHUB_SHA"; exit 1; }
echo "sha=$sha" >> "$GITHUB_OUTPUT"
echo "Execution SHA: $sha" | tee -a "$GITHUB_STEP_SUMMARY"
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: crates/workshop/package-lock.json
# Nothing trusts this key: released Workshops embed only the release
# key, and tauri build only warns when the key does not match
# plugins.updater.pubkey. So fork pull requests build signed too, and
# the key showing in a log or the artifact list costs nothing.
- name: Generate the run key
shell: bash
run: |
set -euo pipefail
npm ci --prefix crates/workshop
mkdir -p "$RUNNER_TEMP/run-key"
node crates/workshop/node_modules/@tauri-apps/cli/tauri.js signer generate --ci -w "$RUNNER_TEMP/run-key/run.key"
test -s "$RUNNER_TEMP/run-key/run.key"
test -s "$RUNNER_TEMP/run-key/run.key.pub"
- name: Upload the run key
uses: actions/upload-artifact@v4
with:
name: run-signing-key
path: ${{ runner.temp }}/run-key
if-no-files-found: error
# As long as the bundles, so a rerun of a failed build still
# finds it.
retention-days: 7
build:
name: build (${{ matrix.platform }})
needs: prepare
# The slowest installer build so far took about 20 minutes; a hung one
# should not hold the run for GitHub's 6-hour default.
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
# `bundle` is Tauri's bundle directory for the platform, and `files`
# matches what the build leaves there for an installer: the setup,
# the app's updater archive, or the AppImage, each with its
# signature.
include:
- platform: windows
runner: windows-latest
triple: x86_64-pc-windows-msvc
bundle: nsis
files: Runvil_*-setup.exe*
- platform: macos-arm
runner: macos-latest
triple: aarch64-apple-darwin
bundle: macos
files: Runvil.app.tar.gz*
- platform: macos-intel
runner: macos-latest
triple: x86_64-apple-darwin
bundle: macos
files: Runvil.app.tar.gz*
# ubuntu-22.04 keeps the AppImage at the glibc 2.35 floor.
- platform: linux
runner: ubuntu-22.04
triple: x86_64-unknown-linux-gnu
bundle: appimage
files: Runvil_*.AppImage*
# The installer build in cppalliance/runvil runs Linux ARM64 on
# 24.04, for the glibc 2.38 its Qt IFW needs, so this build does
# too.
- platform: linux-arm
runner: ubuntu-24.04-arm
triple: aarch64-unknown-linux-gnu
bundle: appimage
files: Runvil_*.AppImage*
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.prepare.outputs.execution-sha }}
- name: Report the execution SHA
shell: bash
run: |
actual=$(git rev-parse HEAD)
expected="${{ needs.prepare.outputs.execution-sha }}"
[ "$actual" = "$expected" ] || { echo "checkout $actual does not match execution SHA $expected"; exit 1; }
echo "Execution SHA: $actual"
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
- name: Add the Rust target
run: rustup target add ${{ matrix.triple }}
- name: Cache cargo
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with:
key: ${{ matrix.triple }}
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: crates/workshop/package-lock.json
# The workshop install brings the pinned Tauri CLI.
- name: Install UI dependencies
shell: bash
run: npm ci --prefix crates/workshop
# The Gateway is its own product: every bundle is built with the
# release gateway-pin/pin.json names, which the fetch verifies against
# the pin's sha256 and stages where cargo workshop bundle reads it.
- name: Stage the pinned Gateway
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: node tools/fetch-gateway-sidecar.mjs --target ${{ matrix.triple }}
# A mirror that does not answer makes apt-get wait for a long time, so
# the step fails after 20 minutes. It normally takes under one.
- name: Install the Linux build packages
timeout-minutes: 20
if: startsWith(matrix.platform, 'linux')
run: |
sudo apt-get update
# xdg-utils: the AppImage bundler shells out to xdg-open, which the
# ARM runner images do not preinstall (the x64 image does).
# https://github.com/tauri-apps/tauri-action/issues/1319
# The GStreamer plugins and patchelf: bundleMediaFramework
# (tauri.linux.conf.json) copies every installed plugin into the
# AppImage beside the GStreamer core WebKitGTK already brings, and
# patchelf sets their rpath. Without them the bundled core finds no
# microphone, since it cannot load a system's plugins built for
# another GStreamer version. https://v2.tauri.app/distribute/appimage/
sudo apt-get install -y --no-install-recommends \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio \
gstreamer1.0-alsa patchelf \
libwebkit2gtk-4.1-dev libssl-dev librsvg2-dev xdg-utils
# Tauri's linuxdeploy is an AppImage; extracting it needs no FUSE,
# which the 24.04 image may lack.
# https://github.com/AppImage/AppImageKit/wiki/FUSE
echo "APPIMAGE_EXTRACT_AND_RUN=1" >> "$GITHUB_ENV"
# The Gateway version check inside cargo workshop bundle runs the
# x86_64 Gateway.
- name: Install Rosetta
if: matrix.platform == 'macos-intel'
run: |
if ! arch -x86_64 /usr/bin/true 2>/dev/null; then
sudo softwareupdate --install-rosetta --agree-to-license
fi
arch -x86_64 /usr/bin/true || { echo "Rosetta is required to run the x86_64 Gateway, and it does not run"; exit 1; }
- name: Download the run key
uses: actions/download-artifact@v4
with:
name: run-signing-key
path: ${{ runner.temp }}/run-key
- name: Build the signed bundle
shell: bash
run: |
set -euo pipefail
TAURI_SIGNING_PRIVATE_KEY=$(cat "$RUNNER_TEMP/run-key/run.key")
TAURI_SIGNING_PRIVATE_KEY_PASSWORD=
export TAURI_SIGNING_PRIVATE_KEY TAURI_SIGNING_PRIVATE_KEY_PASSWORD
cargo workshop bundle --target ${{ matrix.triple }} --sign
# The Gateway reaches the setup only through tauri.windows.conf.json's
# externalBin; 7-Zip lists an NSIS setup's files.
- name: The setup holds the Gateway
if: matrix.platform == 'windows'
shell: bash
run: |
setup=$(ls target/x86_64-pc-windows-msvc/release/bundle/nsis/Runvil_*_x64-setup.exe)
listing=$(7z l "$setup")
grep -F runvil-gateway.exe <<< "$listing" || { echo "$listing"; echo "runvil-gateway.exe is not in $setup"; exit 1; }
- name: Clean tree
shell: bash
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "the bundle build dirtied the repository:"
git status --porcelain
exit 1
fi
- name: Upload the bundle's files
uses: actions/upload-artifact@v4
with:
name: bundle-${{ matrix.platform }}
path: target/${{ matrix.triple }}/release/bundle/${{ matrix.bundle }}/${{ matrix.files }}
if-no-files-found: error
retention-days: 7