feat(phase-1/m5.4): desktop-release Gitea workflow — Linux packaging job

Tag (v*.*.*) + workflow_dispatch (same retry rationale as release.yml). Linux
runner only: jpackage cannot cross-compile and macOS/Windows GA is Phase 2
(§8) — commented job stubs record the matrix shape. createDistributable ->
image smoke under xvfb (SKIPPED-with-message if absent, never faked) ->
packageDeb only when dpkg exists (failure degrades to recorded skip) ->
tar.gz bundling packaging/incido.desktop + icon.png -> attach to the release
with release.yml's retry-and-verify upload pattern. .gitignore: root
libobjectbox-jni-linux-x64.so is ObjectBox CWD self-extraction noise.

Verify: python yaml parse (job + 6 steps); packageDeb/createDistributable/
printPackageVersion exist in :desktopApp:tasks; their local runs green per
M5.3 log. First real tag run remains the live check (recorded).
This commit is contained in:
Incido Developer committed 2026-10-06 23:10:11 +13:00
1 parent c894321fdf
commit 6f16e87ec0
3 files changed
+193

No files matched your search

+164
View File
@@ -0,0 +1,164 @@
name: desktop-release
# Phase 1 M5.4 — Linux desktop packaging (jpackage app-image + deb).
# jpackage cannot cross-compile (§7 of the phase plan), and macOS/Windows
# GA is explicitly Phase 2 (§8) — this job therefore runs ONLY on the
# Linux self-hosted runner; the deferred jobs at the bottom document the
# shape the matrix takes when matching runners exist.
on:
push:
tags:
- 'v*.*.*'
# Same retry rationale as release.yml: a tag push pins this file to the
# tag's commit, so re-dispatching against main replays main's current
# workflow against an already-published tag.
workflow_dispatch:
inputs:
tag:
description: 'Existing tag to rebuild desktop assets for, e.g. v0.4.2.0'
required: true
type: string
jobs:
desktop-linux:
name: Build Linux desktop image (+deb when dpkg present)
runs-on: ubuntu-latest
timeout-minutes: 40
env:
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
steps:
- name: Checkout
run: |
git clone https://git.trevena.info/nick/incido.git repo
cd repo
git fetch --depth=1 origin tag "$RELEASE_TAG" || true
git fetch --tags origin
git checkout "$RELEASE_TAG"
- name: Set up JDK 17
run: |
WORKDIR=/var/lib/gitea-runner/work
if [ ! -d "$WORKDIR/jdk" ]; then
wget -q 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' -O /tmp/jdk.tar.gz
mkdir -p "$WORKDIR/jdk"
tar -xzf /tmp/jdk.tar.gz -C "$WORKDIR/jdk" --strip-components=1
rm /tmp/jdk.tar.gz
fi
echo "JAVA_HOME=$WORKDIR/jdk" >> $GITHUB_ENV
echo "PATH=$WORKDIR/jdk/bin:$PATH" >> $GITHUB_ENV
- name: Set up Android SDK
run: |
# Desktop modules don't use it, but AGP evaluation of :app /
# :composeApp needs ANDROID_HOME during the configuration
# phase of every build in this repo. Same cache as dev.yml.
WORKDIR=/var/lib/gitea-runner/work
SDK=$WORKDIR/android-sdk
if [ ! -d "$SDK/cmdline-tools/latest" ]; then
mkdir -p "$SDK"
wget -q 'https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip' -O /tmp/cmdline-tools.zip
unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools-extract
mkdir -p "$SDK/cmdline-tools"
mv /tmp/cmdline-tools-extract/cmdline-tools "$SDK/cmdline-tools/latest"
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools-extract
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null 2>&1 || true
"$SDK/cmdline-tools/latest/bin/sdkmanager" --install \
"platform-tools" \
"platforms;android-34" \
"build-tools;34.0.0" > /dev/null 2>&1
fi
echo "ANDROID_HOME=$SDK" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=$SDK" >> $GITHUB_ENV
- name: Build desktop distribution
timeout-minutes: 30
run: |
cd repo
chmod +x gradlew
./gradlew --stop 2>/dev/null || true
# App-image first — it needs no host tooling (Phase 0 Q6).
./gradlew :desktopApp:createDistributable :desktopApp:printPackageVersion --no-daemon
VERSION=$(./gradlew -q :desktopApp:printPackageVersion | grep PACKAGE-VERSION | awk '{print $2}')
echo "PKG_VERSION=$VERSION" >> $GITHUB_ENV
IMAGE_DIR=desktopApp/build/compose/binaries/main/app/incido
test -x "$IMAGE_DIR/bin/incido"
# M5.3 contract: smoke the IMAGE, not just the run task (the
# jlink runtime hides missing modules until inside the image).
if command -v xvfb-run >/dev/null 2>&1; then
rm -rf /tmp/ci-desktop-smoke
xvfb-run -a "$IMAGE_DIR/bin/incido" --data-dir /tmp/ci-desktop-smoke --self-test --exit-after 6 \
| tee /tmp/desktop-smoke.log
grep -q 'SELFTEST wrote note' /tmp/desktop-smoke.log
echo 'Image smoke PASS'
else
echo 'NO xvfb on this runner — image smoke SKIPPED (recorded, not faked).'
fi
# deb only when dpkg exists; rpm needs rpmbuild (absent here).
if command -v dpkg >/dev/null 2>&1; then
./gradlew :desktopApp:packageDeb --no-daemon || \
echo 'deb packaging failed (recorded; app-image still shipped)'
else
echo 'NO dpkg on this runner — deb build skipped (recorded).'
fi
- name: Stage assets
run: |
cd repo
VERSION="${PKG_VERSION:-$RELEASE_TAG}"
IMAGE_DIR=desktopApp/build/compose/binaries/main/app/incido
# Bundle the M5.3 .desktop template + icon INSIDE the tarball.
cp desktopApp/packaging/incido.desktop desktopApp/packaging/icon.png "$IMAGE_DIR/"
tar -czf "Incido-${VERSION}-linux-x64.tar.gz" -C "$(dirname "$IMAGE_DIR")" incido
ls -la Incido-*.tar.gz
cp desktopApp/build/compose/binaries/main/deb/*.deb "Incido-${VERSION}-linux-x64.deb" 2>/dev/null \
|| echo 'no deb produced (dpkg absent or failed) — asset list will omit it'
- name: Attach desktop assets to the release
env:
GH_TOKEN: ${{ secrets.TOKEN }}
run: |
set -e
cd repo
TAG="$RELEASE_TAG"
API="http://192.168.8.17:3000/api/v1/repos/nick/incido"
RELEASE_ID=$(curl -s "$API/releases/tags/$TAG" \
-H "Authorization: token $GH_TOKEN" \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
if [ -z "$RELEASE_ID" ]; then
echo "No release for $TAG yet (APK release job may not have run) — creating it."
RELEASE_ID=$(curl -s -X POST "$API/releases" \
-H "Authorization: token $GH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Desktop assets for $TAG\",\"draft\":false,\"prerelease\":false}" \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
fi
test -n "$RELEASE_ID"
for ASSET in Incido-*.tar.gz Incido-*.deb; do
[ -f "$ASSET" ] || continue
for attempt in 1 2 3 4 5; do
echo "--- Uploading $ASSET (attempt $attempt/5) ---"
curl -s -f -X POST "$API/releases/$RELEASE_ID/assets?name=$ASSET" \
-H "Authorization: token $GH_TOKEN" \
-F "attachment=@$ASSET" \
--max-time 900 --retry 2 --retry-all-errors --retry-delay 15 >/dev/null || true
if curl -s "$API/releases/$RELEASE_ID" -H "Authorization: token $GH_TOKEN" \
| python3 -c "import sys,json; d=json.load(sys.stdin); sys.exit(0 if any(a['name']=='$ASSET' for a in d['assets']) else 1)"; then
echo "Verified: $ASSET attached."
break
fi
[ "$attempt" = 5 ] && { echo "ERROR: $ASSET not attached after 5 attempts"; exit 1; }
sleep 15
done
done
# Deferred per phase plan §8 (macOS/Windows GA = Phase 2): enable when
# this Gitea instance has runner labels for those OSes. jpackage will
# not cross-compile; each OS needs its own host.
#
# desktop-macos:
# runs-on: macos-latest # (a self-hosted macOS runner label)
# steps: [ ...createDistributable with Dmg; codesigning TBD... ]
# desktop-windows:
# runs-on: windows-latest # (a self-hosted Windows runner label)
# steps: [ ...createDistributable with Msi/Exe... ]
+4
View File
@@ -30,6 +30,10 @@ captures/
# :core:data-jvm), so default.json is tracked and everything else stays out. # :core:data-jvm), so default.json is tracked and everything else stays out.
**/objectbox-models/* **/objectbox-models/*
!**/objectbox-models/default.json !**/objectbox-models/default.json
# ObjectBox self-extraction lands this at the process CWD (repo root for
# gradle runs) — a build artifact, never source (the tracked copies live in
# desktopApp/ and core/data-jvm/).
/libobjectbox-jni-linux-x64.so
# VS Code # VS Code
.vscode/ .vscode/
+25
View File
@@ -947,6 +947,31 @@ M5.3 suite:
**Next up: M5.4** — CI packaging job on the Gitea runner. **Next up: M5.4** — CI packaging job on the Gitea runner.
**M5.4 — CI packaging job: DONE (pending one real tag run).**
- `.gitea/workflows/desktop-release.yml`: tag push `v*.*.*` +
workflow_dispatch retry path (same rationale comment as release.yml),
on the Linux self-hosted runner only — jpackage can't cross-compile
and §8 defers macOS/Windows GA to Phase 2 (job stubs left as commented
shape). This forge is Gitea, so "GitHub Actions matrix" §7 means the
instance's own runners; macOS/Windows need their own hosts + labels.
- Job: `createDistributable` + `printPackageVersion` → **image smoke**
(`xvfb-run bin/incido --self-test`, SKIPPED-with-message if no xvfb —
recorded, never faked) → `packageDeb` only when `dpkg` exists (deb
failure degrades to a recorded skip; the app-image still ships) →
tar.gz bundle including `packaging/incido.desktop` + `icon.png` →
attach to the release via the same Gitea API + retry-and-verify
pattern release.yml uses (Cloudflare 524 lesson reused).
- Local verification possible without pushing a tag: YAML parses (jobs/
steps listed above), `packageDeb`/`createDistributable`/
`printPackageVersion` all exist as tasks, and their local runs are
green from M5.3. **First real tag run is the remaining live check.**
- `.gitignore`: root `libobjectbox-jni-linux-x64.so` — ObjectBox's
self-extraction drops it at the process CWD during gradle runs; the
tracked natives stay in `desktopApp/` + `core/data-jvm/`.
**Next up: M5.5** — §9 perf pass on the real screens.