Files
photoreport/.gitea/workflows/desktop-release.yml
T
spark 6e8e67b6f6
desktop-release / build (--target universal-apple-darwin, dmg,app, darwin-universal, macos) (push) Failing after 1m13s
ci / typescript (push) Failing after 2m51s
ci / rust (push) Successful in 12m46s
desktop-release / build (deb,appimage, linux-x86_64, ubuntu-latest) (push) Failing after 15m26s
feat(desktop): publish 0.3.31
The Mac build of 0.3.30 never produced an installer.
2026-11-06 22:05:26 +00:00

121 lines
6.0 KiB
YAML

name: desktop-release
# Tag `desktop-vX.Y.Z` builds the desktop installers and attaches them to a Gitea release.
# Linux builds on the standard runner. macOS (.dmg) builds on a Mac registered as a runner with the label "macos"
# (infra/desktop/macos-runner.sh, once); a release made while that Mac is off waits for it. Windows (.msi) needs a
# runner labelled "windows": register one, then uncomment its entry.
#
# Self-updates (apps/desktop/src-tauri/src/updater.rs): with the secret TAURI_SIGNING_PRIVATE_KEY (and
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD) and the variable TAURI_UPDATER_PUBKEY set (`tauri signer generate`), each job
# also signs its installer and attaches update-<platform>.json; the API serves those to installed apps
# (DESKTOP_RELEASES_API / DESKTOP_RELEASES_TOKEN on the API). Without them, installers are built as before.
on:
push:
tags: ["desktop-v*"]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
bundles: deb,appimage
platform: linux-x86_64
- runner: macos
bundles: dmg,app
platform: darwin-universal
args: --target universal-apple-darwin
# - runner: windows
# bundles: msi
# platform: windows-x86_64
runs-on: ${{ matrix.runner }}
env:
VITE_API_URL: https://api.next.photoreport.pt
PHOTOREPORT_API_URL: https://api.next.photoreport.pt
PHOTOREPORT_UPDATER_PUBKEY: ${{ vars.TAURI_UPDATER_PUBKEY }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: System libraries (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libsecret-1-dev
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 24.22.1
- name: Rust
shell: bash
run: |
set -euo pipefail
if [[ -x "$HOME/.cargo/bin/rustup" ]]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors --retry-delay 5 -fsSL https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
export PATH="$HOME/.cargo/bin:$PATH"
fi
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
ok=0
for i in 1 2 3 4 5; do
if rustup toolchain install stable --profile minimal && rustup default stable; then
ok=1
break
fi
echo "rustup download failed ($i/5), retrying"
sleep 15
done
test "$ok" = 1
- name: Both Mac processors (universal app)
if: runner.os == 'macOS'
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
- name: Photo engine (WebAssembly)
run: |
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version "$(sed -n 's/^wasm-bindgen = "=\(.*\)"/\1/p' engine/wasm/Cargo.toml)" --locked
bash infra/engine/build-wasm.sh
- run: pnpm install
- run: pnpm --filter "./packages/*" build
- run: pnpm --filter @photoreport/desktop icons
- name: Installers
shell: bash
run: |
extra=()
# Signed updater artifacts only when the release key is there (a build without it still works).
# The bundler checks each signature against plugins.updater.pubkey, so the public key goes into the config too.
if [[ -n "$TAURI_SIGNING_PRIVATE_KEY" ]]; then
extra=(--config "$(node -e 'console.log(JSON.stringify({bundle:{createUpdaterArtifacts:true},plugins:{updater:{pubkey:process.env.PHOTOREPORT_UPDATER_PUBKEY}}}))')")
fi
pnpm --filter @photoreport/desktop exec tauri build --bundles ${{ matrix.bundles }} ${{ matrix.args }} "${extra[@]}"
- name: Update manifest
if: env.TAURI_SIGNING_PRIVATE_KEY != ''
shell: bash
run: |
# The bundle folder: target/<triple>/release/bundle (cross builds) or target/release/bundle. (A plain `ls` of
# both exits 2 for the one that doesn't exist, which ended the step under pipefail.)
dir=""
for d in apps/desktop/src-tauri/target/*/release/bundle apps/desktop/src-tauri/target/release/bundle; do
if [[ -d "$d" ]]; then dir="$d"; break; fi
done
node infra/desktop/update-manifest.mjs "$dir" ${{ matrix.platform }} "${GITHUB_REF_NAME}"
- uses: actions/upload-artifact@v3
with:
name: desktop-${{ matrix.runner }}
path: apps/desktop/src-tauri/target/**/bundle/**
- name: Attach to the release
shell: bash
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
api="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
tag="${GITHUB_REF_NAME}"
id=$(curl -fsS -H "Authorization: token $TOKEN" "$api/releases/tags/$tag" | node -pe 'JSON.parse(require("fs").readFileSync(0)).id' 2>/dev/null || true)
if [[ -z "$id" || "$id" == "undefined" ]]; then
id=$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"$tag\",\"name\":\"PhotoReport $tag\"}" "$api/releases" | node -pe 'JSON.parse(require("fs").readFileSync(0)).id')
fi
find apps/desktop/src-tauri/target -path '*/bundle/*' -type f \( -name '*.dmg' -o -name '*.app.tar.gz' -o -name '*.msi' -o -name '*-setup.exe' -o -name '*.deb' -o -name '*.AppImage' -o -name '*.sig' -o -name 'update-*.json' \) |
while read -r f; do curl -fsS -H "Authorization: token $TOKEN" -F "attachment=@$f" "$api/releases/$id/assets?name=$(basename "$f")" >/dev/null; echo "attached $(basename "$f")"; done