No repo secrets: unsigned image, updates as release assets, job image built by mkosi
os / os (push) Successful in 3m51s

The workflow's own token can't write packages and repo secrets can't be
set, so: build unsigned, publish the sysupdate files as assets of the
"latest" release, and build the job image with mkosi and ship it in /usr
instead of pushing it to a registry. Partition UUIDs are now part of the
update file names, so updated /usr partitions keep the UUIDs usrhash=
expects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-12 23:21:42 +01:00
1 parent d4eebeb01f
commit dfa5d69b44
16 files changed
+107 -108

No files matched your search

+21 -21
View File
@@ -1,13 +1,9 @@
# git-runner OS image
#
# Builds the OS image with mkosi, signed for Secure Boot, and publishes it in this Gitea's generic
# package registry, where runners fetch their updates (mkosi.extra/usr/lib/sysupdate.d):
# https://git.plabble.org/api/packages/job79/generic/git-runner-mkosi/latest/
# Builds the OS image, with the job image inside, and publishes it as assets of this repository's
# "latest" release, where runners fetch their updates (mkosi.extra/usr/lib/sysupdate.d).
# Runs on every push, weekly for Fedora updates, and by hand. The weekly and manual runs also
# publish the disk image for new installs (git-runner.qcow2 in the same place).
#
# Secrets:
# - SECUREBOOT_KEY the private key for mkosi.crt
# publish the disk image for new installs (git-runner.qcow2).
name: os
on:
push:
@@ -20,39 +16,43 @@ jobs:
os:
runs-on: fedora
env:
PACKAGE: https://git.plabble.org/api/packages/job79/generic/git-runner-mkosi/latest
AUTH: ${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}
API: ${{ github.api_url }}/repos/${{ github.repository }}/releases
AUTH: "Authorization: token ${{ github.token }}"
steps:
- name: Install tools
run: dnf install -yq git-core mkosi jq
- name: Check out
uses: builtin:checkout
- name: Build
env:
SECUREBOOT_KEY: ${{ secrets.SECUREBOOT_KEY }}
run: |
(umask 077; printenv SECUREBOOT_KEY > mkosi.key)
mkosi --secure-boot=yes build
run: mkosi build
- name: Compress
working-directory: mkosi.output
run: |
zstd -q --rm -T0 -19 git-runner_*.usr-*.raw
sha256sum git-runner_*.efi git-runner_*.usr-*.raw.zst > SHA256SUMS
- name: Find the release
run: |
release=$(curl -fsS -H "$AUTH" "$API/tags/latest") ||
release=$(curl -fsS -H "$AUTH" -H 'Content-Type: application/json' "$API" -d '{"tag_name": "latest", "name": "latest"}')
echo "RELEASE=$API/$(jq .id <<<"$release")" >> "$GITHUB_ENV"
# Uploads the update, then replaces SHA256SUMS, which tells runners it is there.
- name: Publish the update
working-directory: mkosi.output
run: |
for f in $(awk '{print $2}' SHA256SUMS); do curl -fsS -u "$AUTH" --upload-file "$f" "$PACKAGE/$f"; done
curl -fsS -u "$AUTH" -X DELETE "$PACKAGE/SHA256SUMS" || true
curl -fsS -u "$AUTH" --upload-file SHA256SUMS "$PACKAGE/SHA256SUMS"
for f in $(awk '{print $2}' SHA256SUMS); do curl -fsS -o /dev/null -H "$AUTH" -F "attachment=@$f" "$RELEASE/assets?name=$f"; done
old=$(curl -fsS -H "$AUTH" "$RELEASE/assets" | jq '.[] | select(.name == "SHA256SUMS") | .id')
[ -z "$old" ] || curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$old"
curl -fsS -o /dev/null -H "$AUTH" -F attachment=@SHA256SUMS "$RELEASE/assets?name=SHA256SUMS"
- name: Remove older versions
working-directory: mkosi.output
run: |
curl -fsS -u "$AUTH" https://git.plabble.org/api/v1/packages/job79/generic/git-runner-mkosi/latest/files | jq -r '.[].name' | grep '^git-runner_' |
grep -vxFf <(awk '{print $2}' SHA256SUMS) | while read -r f; do curl -fsS -u "$AUTH" -X DELETE "$PACKAGE/$f"; done
curl -fsS -H "$AUTH" "$RELEASE/assets" | jq -r '.[] | "\(.id) \(.name)"' | grep ' git-runner_' |
grep -vFf <(awk '{print " " $2}' SHA256SUMS) | while read -r id name; do curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$id"; done
- name: Publish the disk image
if: github.event_name != 'push'
working-directory: mkosi.output
run: |
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
curl -fsS -u "$AUTH" -X DELETE "$PACKAGE/git-runner.qcow2" || true
curl -fsS -u "$AUTH" --upload-file git-runner.qcow2 "$PACKAGE/git-runner.qcow2"
old=$(curl -fsS -H "$AUTH" "$RELEASE/assets" | jq '.[] | select(.name == "git-runner.qcow2") | .id')
[ -z "$old" ] || curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$old"
curl -fsS -o /dev/null -H "$AUTH" -F attachment=@git-runner.qcow2 "$RELEASE/assets?name=git-runner.qcow2"