actions/checkout needs Node.js in every job and fetches the action from GitHub. Four lines of git need neither. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
2.7 KiB
YAML
74 lines
2.7 KiB
YAML
# os.yml builds the OS image and publishes it as version "latest". VMs fetch
|
|
# the built images as updates (mkosi.extra/usr/lib/sysupdate.d). It runs on
|
|
# every push, weekly for package updates, and by hand for critical CVEs.
|
|
#
|
|
# Required values:
|
|
# - SECUREBOOT_KEY repository secret: the private key of mkosi.crt, written
|
|
# to mkosi.key.
|
|
# - SIGNING_KEY repository secret: the armored private gpg key whose
|
|
# public half is mkosi.extra/usr/lib/systemd/
|
|
# import-pubring.pgp, which systemd-sysupdate checks.
|
|
name: os
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
schedule:
|
|
- cron: "0 2 * * 0"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
os:
|
|
runs-on: linux
|
|
# permissions lets gitea.token check out the repository and publish the
|
|
# package.
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Install tools
|
|
run: dnf install -yq mkosi git-core
|
|
# Check out fetches the commit with git, which needs no Node.js and no
|
|
# action from GitHub. gitea-runner 6 removed builtin:checkout.
|
|
- name: Check out
|
|
env:
|
|
AUTH: "Authorization: token ${{ gitea.token }}"
|
|
run: |
|
|
git init -q
|
|
git -c http.extraHeader="$AUTH" fetch -q --depth 1 \
|
|
"${{ gitea.server_url }}/${{ gitea.repository }}" "${{ gitea.sha }}"
|
|
git checkout -q FETCH_HEAD
|
|
- name: Build
|
|
env:
|
|
KEY: ${{ secrets.SECUREBOOT_KEY }}
|
|
run: |
|
|
(umask 077 && printf '%s\n' "$KEY" > mkosi.key)
|
|
mkosi build
|
|
- name: Compress
|
|
working-directory: mkosi.output
|
|
run: |
|
|
zstd -q --rm -9 agentos_*.usr-*.raw
|
|
- name: Checksum
|
|
working-directory: mkosi.output
|
|
run: sha256sum agentos_*.efi agentos_*.usr-*.raw.zst > SHA256SUMS
|
|
- name: Sign
|
|
working-directory: mkosi.output
|
|
env:
|
|
KEY: ${{ secrets.SIGNING_KEY }}
|
|
run: |
|
|
export GNUPGHOME=$(mktemp -d)
|
|
gpg -q --batch --import <<< "$KEY"
|
|
gpg -q --batch -o SHA256SUMS.gpg --detach-sign SHA256SUMS
|
|
- name: Build qcow2
|
|
working-directory: mkosi.output
|
|
run: qemu-img convert -c -O qcow2 "$(basename agentos_*.efi .efi).raw" agentos.qcow2
|
|
- name: Publish
|
|
working-directory: mkosi.output
|
|
env:
|
|
PKG: ${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/agentos/latest
|
|
AUTH: "Authorization: token ${{ gitea.token }}"
|
|
run: |
|
|
curl -fsS -H "$AUTH" -X DELETE "$PKG" || true
|
|
for f in agentos_*.efi agentos_*.usr-*.raw.zst agentos.qcow2 agentos_*.manifest SHA256SUMS.gpg SHA256SUMS; do
|
|
curl -fsS -o /dev/null -H "$AUTH" --upload-file "$f" "$PKG/$f"
|
|
done
|