fingerprintd/.forgejo/workflows/package.yml
Jorijn van der Graaf 51f476e596
the agent prints the daemon's version, from the constant the packaging reads
The agent answered --version with "fingerprintd-agent 0.2.2", the string
it was written with, while the daemon's constant went 0.2.3, 0.2.4, 0.2.5:
the subpackage carried the package's version and reported another. The
constant moves from main.cpp into the module both products import, with
its note on what a bump publishes; the two scripts that derive pkgver
from it, the APKBUILD's header and the CI comment name the new file. The
APKBUILD's own pkgver stays a hand-kept copy, which a bump changes too.
2026-10-14 01:37:38 +02:00

66 lines
2.5 KiB
YAML

name: package
# Builds the fingerprintd apk for aarch64 from the pushed commit and publishes
# it to the Forgejo Alpine registry — the repo installed phones already point
# at (via catcrafts-fp6-repo), so a release reaches users through plain
# 'apk upgrade' without an fp6-img image run.
#
# Build: crafter-build cross-compiles against an Alpine aarch64 sysroot
# (packaging/build-package.sh — the README's "Cross-compiling" flow), the test
# suite runs natively, and packaging/APKBUILD wraps the result. This needs no
# privileged runner: it runs in an alpine:edge container on the ordinary
# arch-latest runner.
#
# Release gating is the version: pkgver comes from interfaces/Fingerprintd.cppm,
# the registry answers 409 for an already-published version, and the publish
# step treats that as "nothing to do" — so pushes only release when the
# Version constant bumps.
#
# Publishing needs PACKAGE_TOKEN (catbot account, package:write scope) — an
# org-level secret on Catcrafts, shared with imsd and fp6-img; without it the
# build still runs and the publish step skips quietly.
on:
workflow_dispatch:
push:
branches: [main]
jobs:
package:
runs-on: arch-latest
container:
image: alpine:edge
timeout-minutes: 90
steps:
# actions/checkout is a Node action; bare alpine has no node
- name: Provision job container
run: apk add -q nodejs git curl
- name: Checkout
uses: actions/checkout@v4
- name: Build and package
run: ./packaging/build-package.sh
- name: Publish to the apk registry
env:
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
run: |
if [ -z "$PACKAGE_TOKEN" ]; then
echo "no PACKAGE_TOKEN secret configured; skipping package publish"
exit 0
fi
found=0
for f in /home/build/.local/share/abuild/*/aarch64/fingerprintd*.apk; do
[ -e "$f" ] || continue
found=1
code=$(curl -s -o /dev/null -w '%{http_code}' \
--user "catbot:$PACKAGE_TOKEN" --upload-file "$f" \
"https://forgejo.catcrafts.net/api/packages/Catcrafts/alpine/edge/fp6")
case "$code" in
201) echo "published: $(basename "$f")" ;;
409) echo "already published: $(basename "$f")" ;;
*) echo "FAILED ($code): $(basename "$f")"; exit 1 ;;
esac
done
[ "$found" = 1 ] || { echo "no packages found to publish"; exit 1; }