imsd/.forgejo/workflows/package.yml
Jorijn van der Graaf e85136982c
Some checks failed
package / package (push) Has been cancelled
ci: build and publish the apk from this repo
A package workflow on the pmos runner: pmbootstrap cross-builds the
aarch64 apk(s) from packaging/aport/ at the pushed commit and uploads
them to the Forgejo Alpine registry, so a daemon release reaches
installed phones via plain 'apk upgrade' without an fp6-img image run.
Releases are gated by pkgver: the registry 409s an already-published
version and the workflow moves on, so ordinary pushes are no-ops until
the aport bumps pkgver/pkgrel.

fp6-img is unchanged: images still build imsd from a pinned checkout of
this repo, from the same aport.

Needs the PACKAGE_TOKEN secret on this repo (or org-wide) to publish;
until then the workflow builds and skips the upload.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-01 23:20:04 +02:00

60 lines
2.3 KiB
YAML

name: package
# Builds the imsd apk(s) for aarch64 from packaging/aport/ at the pushed
# commit and publishes them 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.
#
# Release gating is the pkgver: the registry answers 409 for an
# already-published version and the publish step treats that as "nothing to
# do" — so pushes only release when packaging/aport/APKBUILD bumps
# pkgver/pkgrel. fp6-img images keep building imsd from their own pinned
# checkout of this repo; same aport, so the two pipelines cannot skew.
#
# Runs on the privileged "pmos" runner (qemu-user binfmt on the host for
# pmbootstrap's aarch64 chroots). Requires the PACKAGE_TOKEN secret
# (catbot account, package:write scope) to publish; without it the build
# still runs and the publish step skips quietly.
on:
workflow_dispatch:
push:
branches: [main]
jobs:
package:
runs-on: pmos
timeout-minutes: 180
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 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/var/pmbootstrap/packages/*/aarch64/imsd*.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; }