-
Notifications
You must be signed in to change notification settings - Fork 12
490 lines (467 loc) · 17.8 KB
/
release.yml
File metadata and controls
490 lines (467 loc) · 17.8 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Artifact version label (for manual runs)"
required: false
default: "manual"
build_linux:
description: "Build Linux (x86_64 + aarch64)"
type: boolean
required: false
default: true
build_macos:
description: "Build macOS (aarch64)"
type: boolean
required: false
default: false
build_windows:
description: "Build Windows (x86_64)"
type: boolean
required: false
default: false
build_docker:
description: "Build and push Docker image"
type: boolean
required: false
default: true
publish_release:
description: "Publish a GitHub Release"
type: boolean
required: false
default: false
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
packages: write
jobs:
build-linux:
name: linux-x86_64-unknown-linux-gnu
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_linux == 'true'
# Pinned to Ubuntu 24.04 (glibc 2.39). vykar-gui (Slint) needs newer system libs.
# If bumped, update MIN_GLIBC_MAJOR/MIN_GLIBC_MINOR in docs/src/install.sh.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-linux
cache-on-failure: true
- name: Install Linux GUI deps
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev libgtk-3-dev libxdo-dev \
libxkbcommon-dev libayatana-appindicator3-dev || \
sudo apt-get install -y libappindicator3-dev
- name: Build
run: cargo build --release -p vykar-cli -p vykar-server -p vykar-gui
- name: Package
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
ARCHIVE="vykar-${VERSION}-x86_64-unknown-linux-gnu.tar.gz"
tar -czf "${ARCHIVE}" -C target/release vykar vykar-server vykar-gui
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-unknown-linux-gnu
path: vykar-*.tar.gz
build-appimage:
name: linux-x86_64-appimage
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_linux == 'true'
needs: build-linux
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Download Linux build artifact
uses: actions/download-artifact@v4
with:
name: linux-x86_64-unknown-linux-gnu
path: dist
- name: Extract vykar-gui binary
run: tar xzf dist/vykar-*.tar.gz -C dist/ vykar-gui
- name: Install AppImage tooling
run: |
sudo apt-get update
sudo apt-get install -y librsvg2-bin \
libglib2.0-dev libgtk-3-dev libxdo-dev \
libxkbcommon-dev libayatana-appindicator3-dev || \
sudo apt-get install -y libappindicator3-dev
wget -q "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" \
-O /usr/local/bin/linuxdeploy
chmod +x /usr/local/bin/linuxdeploy
- name: Build AppImage
env:
APPIMAGE_EXTRACT_AND_RUN: 1
run: scripts/build-appimage.sh dist/vykar-gui .
- name: Verify AppImage contents
env:
APPIMAGE_EXTRACT_AND_RUN: 1
run: |
chmod +x ./*.AppImage
./*.AppImage --appimage-extract
# AppDir contract
test -x squashfs-root/AppRun
test -f squashfs-root/vykar-gui.desktop
test -f squashfs-root/vykar-gui.png
test -x squashfs-root/usr/bin/vykar-gui
# Must-bundle: libxdo (the whole reason for this feature)
ls squashfs-root/usr/lib/libxdo.so* > /dev/null
# Must-not-bundle: GPU/driver libs
! ls squashfs-root/usr/lib/libGL.so* 2>/dev/null
! ls squashfs-root/usr/lib/libEGL.so* 2>/dev/null
! ls squashfs-root/usr/lib/libvulkan.so* 2>/dev/null
! ls squashfs-root/usr/lib/libdrm.so* 2>/dev/null
rm -rf squashfs-root
- name: Rename and upload
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
mv ./*.AppImage "vykar-gui-${VERSION}-x86_64.AppImage"
- uses: actions/upload-artifact@v4
with:
name: linux-x86_64-appimage
path: vykar-gui-*.AppImage
build-linux-musl:
name: linux-x86_64-unknown-linux-musl
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_linux == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-linux-musl
cache-on-failure: true
- name: Install musl tools
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Build
run: cargo build --release --target x86_64-unknown-linux-musl -p vykar-cli -p vykar-server
- name: Package
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
ARCHIVE="vykar-${VERSION}-x86_64-unknown-linux-musl.tar.gz"
tar -czf "${ARCHIVE}" -C target/x86_64-unknown-linux-musl/release vykar vykar-server
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-unknown-linux-musl
path: vykar-*.tar.gz
build-linux-arm64:
name: linux-aarch64-unknown-linux-gnu
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_linux == 'true'
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-linux-arm64
cache-on-failure: true
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: Build
run: cargo build --release -p vykar-cli -p vykar-server
- name: Package
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
ARCHIVE="vykar-${VERSION}-aarch64-unknown-linux-gnu.tar.gz"
tar -czf "${ARCHIVE}" -C target/release vykar vykar-server
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-aarch64-unknown-linux-gnu
path: vykar-*.tar.gz
build-linux-arm64-musl:
name: linux-aarch64-unknown-linux-musl
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_linux == 'true'
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-linux-arm64-musl
cache-on-failure: true
- name: Install musl tools
run: |
sudo apt-get update
sudo apt-get install -y musl-tools cmake
- name: Build
run: cargo build --release --target aarch64-unknown-linux-musl -p vykar-cli -p vykar-server
- name: Package
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
ARCHIVE="vykar-${VERSION}-aarch64-unknown-linux-musl.tar.gz"
tar -czf "${ARCHIVE}" -C target/aarch64-unknown-linux-musl/release vykar vykar-server
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-aarch64-unknown-linux-musl
path: vykar-*.tar.gz
build-macos:
name: macos-aarch64-apple-darwin
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_macos == 'true'
runs-on: macos-14
environment: release
env:
HAS_SIGNING: ${{ secrets.MACOS_CERTIFICATE }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-macos
cache-on-failure: true
- name: Build
run: cargo build --release --target aarch64-apple-darwin -p vykar-cli -p vykar-server -p vykar-gui
- name: Create app bundle
run: |
RELEASE_DIR="target/aarch64-apple-darwin/release"
APP_BUNDLE="${RELEASE_DIR}/Vykar Backup.app"
mkdir -p "${APP_BUNDLE}/Contents/MacOS" "${APP_BUNDLE}/Contents/Resources"
cp crates/vykar-gui/macos/Info.plist "${APP_BUNDLE}/Contents/"
cp "${RELEASE_DIR}/vykar-gui" "${APP_BUNDLE}/Contents/MacOS/"
brew install librsvg
crates/vykar-gui/macos/create-icns.sh docs/src/images/logo-colored-gradient.svg "${APP_BUNDLE}/Contents/Resources/AppIcon.icns"
- name: Import signing certificate
if: env.HAS_SIGNING != ''
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
run: |
KEYCHAIN_PATH="$RUNNER_TEMP/signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -base64 32)"
echo "$MACOS_CERTIFICATE" | base64 --decode > "$RUNNER_TEMP/certificate.p12"
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security import "$RUNNER_TEMP/certificate.p12" -P "$MACOS_CERTIFICATE_PASSWORD" \
-A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain
rm "$RUNNER_TEMP/certificate.p12"
- name: Sign and notarize macOS binaries
if: env.HAS_SIGNING != ''
env:
CERTIFICATE_NAME: ${{ secrets.CERTIFICATE_NAME }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}
run: |
RELEASE_DIR="target/aarch64-apple-darwin/release"
echo "${{ secrets.APPLE_API_KEY }}" | base64 --decode > "$RUNNER_TEMP/AuthKey.p8"
export APPLE_API_KEY="$RUNNER_TEMP/AuthKey.p8"
scripts/macos-sign.sh \
"${RELEASE_DIR}/Vykar Backup.app" \
"${RELEASE_DIR}/vykar" \
"${RELEASE_DIR}/vykar-server"
rm -f "$RUNNER_TEMP/AuthKey.p8"
- name: Package
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME}"
fi
RELEASE_DIR="target/aarch64-apple-darwin/release"
ARCHIVE="vykar-${VERSION}-aarch64-apple-darwin.tar.gz"
tar -czf "${ARCHIVE}" -C "${RELEASE_DIR}" vykar vykar-server "Vykar Backup.app"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-aarch64-apple-darwin
path: vykar-*.tar.gz
build-windows:
name: windows-x86_64-pc-windows-msvc
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_windows == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-windows
cache-on-failure: true
- name: Build
run: cargo build --release --target x86_64-pc-windows-msvc -p vykar-cli -p vykar-server -p vykar-gui
- name: Package
shell: pwsh
run: |
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
$version = "${{ github.event.inputs.version }}"
} else {
$version = "${{ github.ref_name }}"
}
$archive = "vykar-$version-x86_64-pc-windows-msvc.zip"
Compress-Archive -Path "target/x86_64-pc-windows-msvc/release/vykar.exe","target/x86_64-pc-windows-msvc/release/vykar-server.exe","target/x86_64-pc-windows-msvc/release/vykar-gui.exe" -DestinationPath $archive -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-x86_64-pc-windows-msvc
path: vykar-*.zip
sign-windows:
name: sign-windows
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_windows == 'true'
needs: build-windows
runs-on: ubuntu-latest
environment: release
env:
HAS_SIGNING: ${{ secrets.CERTUM_CERT_SHA1 }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
if: env.HAS_SIGNING != ''
with:
name: windows-x86_64-pc-windows-msvc
path: dist
- name: Sign Windows binaries
if: env.HAS_SIGNING != ''
env:
CERTUM_SIMPLYSIGN_USER: ${{ secrets.CERTUM_SIMPLYSIGN_USER }}
CERTUM_TOTP_SECRET: ${{ secrets.CERTUM_TOTP_SECRET }}
CERTUM_CERT_PEM: ${{ secrets.CERTUM_CERT_PEM }}
run: |
ARCHIVE=$(ls dist/vykar-*.zip)
unzip -o "$ARCHIVE" -d dist/unsigned
scripts/windows-sign.sh dist/unsigned/*.exe
rm -f "$ARCHIVE"
cd dist && zip -j "$(basename "$ARCHIVE" .zip).zip" unsigned/*.exe && cd ..
- uses: actions/upload-artifact@v4
if: env.HAS_SIGNING != ''
with:
name: windows-x86_64-pc-windows-msvc
path: dist/vykar-*.zip
overwrite: true
release:
name: publish
runs-on: ubuntu-latest
if: >-
always() && !failure() && !cancelled() &&
(github.event_name == 'push' || github.event.inputs.publish_release == 'true')
needs:
- build-linux
- build-appimage
- build-linux-musl
- build-linux-arm64
- build-linux-arm64-musl
- build-macos
- sign-windows
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: '{linux,macos,windows}-*'
merge-multiple: true
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/*
docker:
name: docker
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_docker == 'true'
needs: [build-linux-musl, build-linux-arm64-musl]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: linux-x86_64-unknown-linux-musl
path: artifacts/amd64
- uses: actions/download-artifact@v4
with:
name: linux-aarch64-unknown-linux-musl
path: artifacts/arm64
- name: Arrange binaries by platform
run: |
mkdir -p bin/linux/amd64 bin/linux/arm64
tar xzf artifacts/amd64/vykar-*.tar.gz -C bin/linux/amd64
tar xzf artifacts/arm64/vykar-*.tar.gz -C bin/linux/arm64
chmod +x bin/linux/*/vykar bin/linux/*/vykar-server
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest version tag
id: version
run: |
git fetch --tags
echo "tag=$(git tag -l 'v*' --sort=-v:refname | head -1 | sed 's/^v//')" >> "$GITHUB_OUTPUT"
- id: meta-apprise
uses: docker/metadata-action@v5
with:
images: ghcr.io/borgbase/vykar
flavor: |
suffix=-apprise,onlatest=true
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
type=raw,value=latest
type=raw,value=${{ steps.version.outputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
- uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.apprise
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta-apprise.outputs.tags }}
labels: ${{ steps.meta-apprise.outputs.labels }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/borgbase/vykar
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
type=raw,value=latest
type=raw,value=${{ steps.version.outputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}