mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-17 22:21:26 +01:00
482 lines
21 KiB
YAML
482 lines
21 KiB
YAML
name: Release App Artifacts
|
|
on:
|
|
push:
|
|
tags: [v*]
|
|
# The Yaak Proxy dry run only: builds, signs and notarizes the proxy for the chosen ref and
|
|
# keeps the results as workflow artifacts. It never builds Yaak, releases, tags or publishes.
|
|
workflow_dispatch:
|
|
inputs:
|
|
proxy_dry_run:
|
|
description: "Dry-run the Yaak Proxy build (artifacts only; nothing is released)"
|
|
type: boolean
|
|
required: true
|
|
default: true
|
|
proxy_version:
|
|
description: "Version to stamp into the dry-run build"
|
|
type: string
|
|
required: true
|
|
default: "0.0.1-dryrun"
|
|
|
|
jobs:
|
|
build-artifacts:
|
|
if: github.repository == 'mountain-loop/yaak' && github.event_name == 'push'
|
|
permissions:
|
|
contents: write
|
|
|
|
name: Build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: "macos-latest" # for Arm-based Macs (M1 and above).
|
|
args: '--target aarch64-apple-darwin --config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}'''
|
|
yaak_arch: "arm64"
|
|
os: "macos"
|
|
runtime: "wry"
|
|
targets: "aarch64-apple-darwin"
|
|
- platform: "macos-latest" # for Intel-based Macs.
|
|
args: '--target x86_64-apple-darwin --config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}'''
|
|
yaak_arch: "x64"
|
|
os: "macos"
|
|
runtime: "wry"
|
|
targets: "x86_64-apple-darwin"
|
|
- platform: "ubuntu-22.04"
|
|
args: '--config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}'''
|
|
yaak_arch: "x64"
|
|
os: "ubuntu"
|
|
runtime: "wry"
|
|
targets: ""
|
|
- platform: "ubuntu-22.04-arm"
|
|
args: '--config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}'''
|
|
yaak_arch: "arm64"
|
|
os: "ubuntu"
|
|
runtime: "wry"
|
|
targets: ""
|
|
- platform: "ubuntu-22.04"
|
|
args: >-
|
|
--bundles deb
|
|
--config ./tauri.release.conf.json
|
|
--config '{"productName":"yaak-cef","mainBinaryName":"yaak-cef","identifier":"app.yaak.desktop.cef","build":{"features":["license","cef"]},"bundle":{"createUpdaterArtifacts":false}}'
|
|
yaak_arch: "x64"
|
|
os: "ubuntu"
|
|
runtime: "cef"
|
|
targets: ""
|
|
- platform: "ubuntu-22.04-arm"
|
|
args: >-
|
|
--bundles deb
|
|
--config ./tauri.release.conf.json
|
|
--config '{"productName":"yaak-cef","mainBinaryName":"yaak-cef","identifier":"app.yaak.desktop.cef","build":{"features":["license","cef"]},"bundle":{"createUpdaterArtifacts":false}}'
|
|
yaak_arch: "arm64"
|
|
os: "ubuntu"
|
|
runtime: "cef"
|
|
targets: ""
|
|
- platform: "windows-latest"
|
|
args: '--config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}'''
|
|
yaak_arch: "x64"
|
|
os: "windows"
|
|
runtime: "wry"
|
|
targets: ""
|
|
# Windows ARM64
|
|
- platform: "windows-latest"
|
|
args: '--target aarch64-pc-windows-msvc --config ./tauri.release.conf.json --config ''{"build":{"features":["updater","license","wry"]}}'''
|
|
yaak_arch: "arm64"
|
|
os: "windows"
|
|
runtime: "wry"
|
|
targets: "aarch64-pc-windows-msvc"
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 360
|
|
steps:
|
|
- name: Checkout yaakapp/app
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Vite+
|
|
uses: voidzero-dev/setup-vp@v1
|
|
with:
|
|
node-version: "24"
|
|
cache: true
|
|
|
|
- name: install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.targets }}
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: ci
|
|
cache-on-failure: true
|
|
|
|
- name: Cache CEF (Linux only)
|
|
if: matrix.os == 'ubuntu' && matrix.runtime == 'cef'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/tauri-cef
|
|
key: cef-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock') }}
|
|
|
|
- name: install dependencies (Linux only)
|
|
if: matrix.os == 'ubuntu'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y cmake ninja-build libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libnss3 patchelf xdg-utils
|
|
# crates/yaak-wasm compiles SQLite to wasm via sqlite-wasm-rs, whose C shim
|
|
# uses C23 [[noreturn]] and expects a freestanding wasm32 target. Ubuntu
|
|
# 22.04 ships only clang <=15: 14 rejects the attribute, and 15 falls
|
|
# through to host glibc headers ("bits/libc-header-start.h" not found).
|
|
# clang-18 handles it (it is what ubuntu-24.04 uses). Install it from
|
|
# apt.llvm.org since 22.04's repos stop at 15. Only the wasm build uses
|
|
# this compiler, so the shipped binary keeps 22.04's glibc floor.
|
|
wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh
|
|
chmod +x /tmp/llvm.sh
|
|
sudo /tmp/llvm.sh 18
|
|
echo "CC_wasm32_unknown_unknown=/usr/bin/clang-18" >> "$GITHUB_ENV"
|
|
echo "AR_wasm32_unknown_unknown=/usr/bin/llvm-ar-18" >> "$GITHUB_ENV"
|
|
|
|
- name: Install Protoc for plugin-runtime
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install trusted-signing-cli (Windows only)
|
|
if: matrix.os == 'windows'
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = 'Stop'
|
|
$dir = "$env:USERPROFILE\trusted-signing"
|
|
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
$url = "https://github.com/Levminer/trusted-signing-cli/releases/download/0.8.0/trusted-signing-cli.exe"
|
|
$exe = Join-Path $dir "trusted-signing-cli.exe"
|
|
Invoke-WebRequest -Uri $url -OutFile $exe
|
|
echo $dir >> $env:GITHUB_PATH
|
|
& $exe --version
|
|
|
|
- run: vp install
|
|
- run: npm run bootstrap
|
|
env:
|
|
YAAK_TARGET_ARCH: ${{ matrix.yaak_arch }}
|
|
- run: npm run lint
|
|
- name: Run JS Tests
|
|
run: vp test
|
|
- name: Run Rust Tests
|
|
run: cargo test --all --exclude yaak-cli --features yaak-app-client/wry
|
|
|
|
- name: Set version
|
|
run: npm run replace-version
|
|
env:
|
|
YAAK_VERSION: ${{ github.ref_name }}
|
|
|
|
- name: Sign vendored binaries (macOS only)
|
|
if: matrix.os == 'macos'
|
|
env:
|
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
|
run: |
|
|
# Create keychain
|
|
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
|
|
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
|
|
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
|
|
|
# Import certificate
|
|
echo "$APPLE_CERTIFICATE" | base64 --decode > certificate.p12
|
|
security import certificate.p12 -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
|
|
security list-keychain -d user -s $KEYCHAIN_PATH
|
|
|
|
# Sign vendored binaries with hardened runtime and their specific entitlements
|
|
codesign --force --options runtime --entitlements crates-tauri/yaak-app-client/macos/entitlements.yaakprotoc.plist --sign "$APPLE_SIGNING_IDENTITY" crates-tauri/yaak-app-client/vendored/protoc/yaakprotoc || true
|
|
codesign --force --options runtime --entitlements crates-tauri/yaak-app-client/macos/entitlements.yaaknode.plist --sign "$APPLE_SIGNING_IDENTITY" crates-tauri/yaak-app-client/vendored/node/yaaknode || true
|
|
|
|
- name: Build and upload Tauri bundles
|
|
uses: tauri-apps/tauri-action@v0
|
|
env:
|
|
YAAK_TARGET_ARCH: ${{ matrix.yaak_arch }}
|
|
|
|
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
|
|
|
# Apple signing stuff
|
|
APPLE_CERTIFICATE: ${{ matrix.os == 'macos' && secrets.APPLE_CERTIFICATE }}
|
|
APPLE_CERTIFICATE_PASSWORD: ${{ matrix.os == 'macos' && secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
APPLE_ID: ${{ matrix.os == 'macos' && secrets.APPLE_ID }}
|
|
APPLE_PASSWORD: ${{ matrix.os == 'macos' && secrets.APPLE_PASSWORD }}
|
|
APPLE_SIGNING_IDENTITY: ${{ matrix.os == 'macos' && secrets.APPLE_SIGNING_IDENTITY }}
|
|
APPLE_TEAM_ID: ${{ matrix.os == 'macos' && secrets.APPLE_TEAM_ID }}
|
|
|
|
# Windows signing stuff
|
|
AZURE_CLIENT_ID: ${{ matrix.os == 'windows' && secrets.AZURE_CLIENT_ID }}
|
|
AZURE_CLIENT_SECRET: ${{ matrix.os == 'windows' && secrets.AZURE_CLIENT_SECRET }}
|
|
AZURE_TENANT_ID: ${{ matrix.os == 'windows' && secrets.AZURE_TENANT_ID }}
|
|
with:
|
|
# Also retries builds; upload retries alone cannot clean up starter assets.
|
|
retryAttempts: 3
|
|
tauriScript: "node ../../node_modules/@tauri-apps/cli/tauri.js"
|
|
tagName: "v__VERSION__"
|
|
releaseName: "Release __VERSION__"
|
|
releaseBody: "<!-- generated-by-yaak-releases -->"
|
|
releaseDraft: true
|
|
prerelease: true
|
|
projectPath: ./crates-tauri/yaak-app-client
|
|
args: "${{ matrix.args }}"
|
|
|
|
# Snapshot before the per-machine build overwrites the regular NSIS bundle/signature.
|
|
- name: Snapshot Tauri bundles
|
|
if: ${{ !cancelled() }}
|
|
run: node .github/scripts/preserve-release-artifacts.mjs
|
|
env:
|
|
RELEASE_TARGET: ${{ matrix.targets }}
|
|
RELEASE_PLATFORM: ${{ matrix.platform }}
|
|
RELEASE_RUNTIME: ${{ matrix.runtime }}
|
|
RELEASE_ARCH: ${{ matrix.yaak_arch }}
|
|
RELEASE_ARGS: ${{ matrix.args }}
|
|
|
|
- name: Build and upload CEF tarball from deb (Linux only)
|
|
if: matrix.os == 'ubuntu' && matrix.runtime == 'cef'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
deb=$(find target/release/bundle/deb -maxdepth 1 -type f -name '*.deb' | head -n 1)
|
|
version="${GITHUB_REF_NAME#v}"
|
|
extract_dir="target/release/bundle/deb/yaak-cef-linux-${{ matrix.yaak_arch }}"
|
|
tarball="target/release/bundle/deb/yaak-cef_${version}_linux_${{ matrix.yaak_arch }}.tar.gz"
|
|
rm -rf "$extract_dir"
|
|
mkdir -p "$extract_dir"
|
|
dpkg-deb -x "$deb" "$extract_dir"
|
|
tar -C "$extract_dir" -czf "$tarball" .
|
|
for attempt in 1 2 3 4; do
|
|
if gh release upload "$GITHUB_REF_NAME" "$tarball" --clobber; then
|
|
break
|
|
fi
|
|
if [ "$attempt" -eq 4 ]; then exit 1; fi
|
|
sleep 10
|
|
done
|
|
|
|
# Build a per-machine NSIS installer for enterprise deployment (PDQ, SCCM, Intune)
|
|
- name: Build and upload machine-wide installer (Windows only)
|
|
if: matrix.os == 'windows'
|
|
shell: pwsh
|
|
env:
|
|
YAAK_TARGET_ARCH: ${{ matrix.yaak_arch }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
|
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
|
|
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
|
run: |
|
|
Get-ChildItem -Recurse -Path target -File -Filter "*.exe.sig" | Remove-Item -Force
|
|
Push-Location crates-tauri/yaak-app-client
|
|
npx tauri bundle ${{ matrix.args }} --bundles nsis --config '{"bundle":{"createUpdaterArtifacts":true,"windows":{"nsis":{"installMode":"perMachine"}}}}'
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
Pop-Location
|
|
$setup = Get-ChildItem -Recurse -Path target -Filter "*setup*.exe" | Select-Object -First 1
|
|
$setupSig = "$($setup.FullName).sig"
|
|
$dest = $setup.FullName -replace '-setup\.exe$', '-setup-machine.exe'
|
|
$destSig = "$dest.sig"
|
|
Copy-Item $setup.FullName $dest
|
|
Copy-Item $setupSig $destSig
|
|
foreach ($asset in @($dest, $destSig)) {
|
|
for ($attempt = 1; $attempt -le 4; $attempt++) {
|
|
gh release upload "$env:GITHUB_REF_NAME" "$asset" --clobber
|
|
if ($LASTEXITCODE -eq 0) { break }
|
|
if ($attempt -eq 4) { exit $LASTEXITCODE }
|
|
Start-Sleep -Seconds 10
|
|
}
|
|
}
|
|
|
|
- name: Snapshot additional release bundles
|
|
if: ${{ !cancelled() }}
|
|
run: node .github/scripts/preserve-release-artifacts.mjs
|
|
env:
|
|
RELEASE_TARGET: ${{ matrix.targets }}
|
|
RELEASE_PLATFORM: ${{ matrix.platform }}
|
|
RELEASE_RUNTIME: ${{ matrix.runtime }}
|
|
RELEASE_ARCH: ${{ matrix.yaak_arch }}
|
|
RELEASE_ARGS: ${{ matrix.args }}
|
|
|
|
- name: Retain release bundles for recovery
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-${{ github.ref_name }}-${{ matrix.platform }}-${{ matrix.runtime }}-${{ matrix.yaak_arch }}-${{ github.run_id }}-attempt-${{ github.run_attempt }}
|
|
path: ${{ runner.temp }}/yaak-release-artifacts/
|
|
retention-days: 7
|
|
if-no-files-found: warn
|
|
|
|
# Yaak Proxy, macOS only, on the same tag and version as Yaak. Its own job, sharing nothing
|
|
# with Yaak's, so a proxy failure never stops Yaak's artifacts; it fails the run, visibly.
|
|
#
|
|
# On a v* tag it runs only once the repository variable RELEASE_PROXY is "true": the website's
|
|
# download links pick Yaak's assets by suffix and architecture, and its release audit expects
|
|
# Yaak's exact asset set and this run's success, so the proxy must not join Yaak's release
|
|
# until the website expects it there. The dry run (workflow_dispatch) runs regardless, and
|
|
# only keeps workflow artifacts.
|
|
build-proxy:
|
|
if: >-
|
|
github.repository == 'mountain-loop/yaak' && (
|
|
(github.event_name == 'push' && vars.RELEASE_PROXY == 'true') ||
|
|
(github.event_name == 'workflow_dispatch' && inputs.proxy_dry_run)
|
|
)
|
|
permissions:
|
|
contents: write
|
|
|
|
name: Build Yaak Proxy
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- target: "aarch64-apple-darwin" # for Arm-based Macs (M1 and above).
|
|
yaak_arch: "arm64"
|
|
lipo_arch: "arm64"
|
|
asset_arch: "aarch64"
|
|
- target: "x86_64-apple-darwin" # for Intel-based Macs.
|
|
yaak_arch: "x64"
|
|
lipo_arch: "x86_64"
|
|
asset_arch: "x64"
|
|
runs-on: macos-latest
|
|
timeout-minutes: 240
|
|
env:
|
|
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' }}
|
|
# The tag, as Yaak's version is taken, or the dry run's own
|
|
PROXY_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.proxy_version || github.ref_name }}
|
|
steps:
|
|
- name: Checkout yaakapp/app
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Vite+
|
|
uses: voidzero-dev/setup-vp@v1
|
|
with:
|
|
node-version: "24"
|
|
cache: true
|
|
|
|
- name: install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
# A cache of its own, so the proxy's builds never change what Yaak's jobs restore
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: release-proxy
|
|
key: ${{ matrix.target }}
|
|
cache-on-failure: true
|
|
|
|
- name: Install Protoc for plugin-runtime
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- run: vp install
|
|
|
|
- name: Set version
|
|
run: npm run replace-version -- proxy
|
|
env:
|
|
YAAK_VERSION: ${{ env.PROXY_VERSION }}
|
|
|
|
- name: Import signing certificate
|
|
env:
|
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
|
run: |
|
|
set -euo pipefail
|
|
KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db"
|
|
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
|
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
|
|
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
|
|
|
echo "$APPLE_CERTIFICATE" | base64 --decode > "$RUNNER_TEMP/certificate.p12"
|
|
security import "$RUNNER_TEMP/certificate.p12" -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
|
|
rm "$RUNNER_TEMP/certificate.p12"
|
|
# Lets codesign use the key unattended; without it the first signature can wait on a
|
|
# prompt nobody answers
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" > /dev/null
|
|
security list-keychain -d user -s "$KEYCHAIN_PATH"
|
|
|
|
# Builds the helper for the target and signs it and protoc before bundling (the bundle
|
|
# config's before-build step), then signs, notarizes and staples the app and makes the
|
|
# updater archive and its signature.
|
|
- name: Build, sign and notarize
|
|
run: >-
|
|
npm run proxy:bundle --
|
|
--target ${{ matrix.target }}
|
|
--bundles dmg
|
|
--config crates-tauri/yaak-app-proxy/tauri.release.conf.json
|
|
env:
|
|
CI: true
|
|
YAAK_TARGET_ARCH: ${{ matrix.yaak_arch }}
|
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
# The helper only answers an app signed by this team
|
|
YAAK_PROXY_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
|
|
|
- name: Verify the bundle
|
|
run: >-
|
|
node scripts/verify-proxy-bundle.mjs
|
|
"target/${{ matrix.target }}/release/bundle/macos/Yaak Proxy.app"
|
|
--signed
|
|
--version "$PROXY_VERSION"
|
|
--arch ${{ matrix.lipo_arch }}
|
|
--team "$YAAK_PROXY_TEAM_ID"
|
|
env:
|
|
YAAK_PROXY_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
|
|
# Named Yaak.Proxy_*, so neither people nor tools take them for Yaak's Yaak_* assets.
|
|
# The app refuses an update not named so (ARTIFACT_PREFIX in yaak-app-proxy's updates.rs).
|
|
- name: Collect the release assets
|
|
run: |
|
|
set -euo pipefail
|
|
bundle="target/${{ matrix.target }}/release/bundle"
|
|
version="${PROXY_VERSION#v}"
|
|
out="$RUNNER_TEMP/yaak-proxy-release"
|
|
mkdir -p "$out"
|
|
dmgs=("$bundle"/dmg/*.dmg)
|
|
if [ "${#dmgs[@]}" -ne 1 ] || [ ! -f "${dmgs[0]}" ]; then
|
|
echo "Expected one .dmg in $bundle/dmg"; exit 1
|
|
fi
|
|
cp "${dmgs[0]}" "$out/Yaak.Proxy_${version}_${{ matrix.asset_arch }}.dmg"
|
|
cp "$bundle/macos/Yaak Proxy.app.tar.gz" "$out/Yaak.Proxy_${{ matrix.asset_arch }}.app.tar.gz"
|
|
cp "$bundle/macos/Yaak Proxy.app.tar.gz.sig" "$out/Yaak.Proxy_${{ matrix.asset_arch }}.app.tar.gz.sig"
|
|
(cd "$out" && shasum -a 256 Yaak.Proxy_* > checksums.txt)
|
|
ls -l "$out"
|
|
|
|
- name: Keep the bundles as workflow artifacts
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: proxy-${{ env.PROXY_VERSION }}-${{ matrix.asset_arch }}-${{ github.run_id }}-attempt-${{ github.run_attempt }}
|
|
path: ${{ runner.temp }}/yaak-proxy-release/
|
|
retention-days: ${{ env.DRY_RUN == 'true' && 14 || 7 }}
|
|
if-no-files-found: error
|
|
|
|
# Yaak's jobs create the draft release; this waits for it rather than making its own,
|
|
# which could race theirs into two drafts.
|
|
- name: Upload to the release
|
|
if: env.DRY_RUN != 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
for attempt in $(seq 1 120); do
|
|
if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then break; fi
|
|
if [ "$attempt" -eq 120 ]; then
|
|
echo "No release for $GITHUB_REF_NAME after two hours; Yaak's jobs make it"; exit 1
|
|
fi
|
|
sleep 60
|
|
done
|
|
for asset in "$RUNNER_TEMP"/yaak-proxy-release/Yaak.Proxy_*; do
|
|
for attempt in 1 2 3 4; do
|
|
if gh release upload "$GITHUB_REF_NAME" "$asset" --clobber; then
|
|
break
|
|
fi
|
|
if [ "$attempt" -eq 4 ]; then exit 1; fi
|
|
sleep 10
|
|
done
|
|
done
|