name: Build Aurora
on:
push:
branches: [main]
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
concurrency:
group: aurora-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: forge.in.quineglobal.com
MIRRORS: https://forge.in.quineglobal.com/quine-global-labs
IMAGE: forge.in.quineglobal.com/quine-global-labs/aurora
TAG: stable
jobs:
build:
runs-on: runner-x86-linux
timeout-minutes: 300
steps:
- uses: https://forge.in.quineglobal.com/quine-global-labs/mirror-actions-checkout@v4
with:
fetch-depth: 0
- name: Merge upstream
if: github.event_name != 'push'
run: |
git config user.name "forgejo-actions"
git config user.email "actions@forge.in.quineglobal.com"
git fetch --no-tags origin main
git checkout -B main FETCH_HEAD
git fetch --no-tags "$MIRRORS/mirror-ublue-os-aurora.git" main
before=$(git rev-parse HEAD)
git merge --no-edit -m "Merge upstream ublue-os/aurora main" FETCH_HEAD
if [ "$(git rev-parse HEAD)" != "$before" ]; then
git push origin HEAD:main
else
echo "Already up to date with upstream."
fi
- name: Point downloads at our mirrors
run: |
files=$(grep -rlE 'github(usercontent)?\.com/(ublue-os/(akmods|countme)|rcaloras/bash-preexec|coreos/fedora-coreos-config)/' build_scripts)
sed -i -E \
-e "s#https://github\.com/ublue-os/akmods/raw/refs/heads/([^/]+)/#$MIRRORS/mirror-ublue-os-akmods/raw/branch/\1/#g" \
-e "s#https://raw\.githubusercontent\.com/ublue-os/countme/([^/]+)/#$MIRRORS/mirror-ublue-os-countme/raw/branch/\1/#g" \
-e "s#https://raw\.githubusercontent\.com/rcaloras/bash-preexec/([0-9a-f]{40})/#$MIRRORS/mirror-rcaloras-bash-preexec/raw/commit/\1/#g" \
-e "s#https://raw\.githubusercontent\.com/coreos/fedora-coreos-config/refs/heads/([^/]+)/#$MIRRORS/mirror-coreos-fedora-coreos-config/raw/branch/\1/#g" \
$files
git update-index --skip-worktree $files
git diff -U0 --no-ext-diff HEAD -- $files | grep '^[-+][^-+]' || true
grep -rn "$MIRRORS" build_scripts
- name: Log in to the registry
env:
REGISTRY_USER: ${{ vars.REGISTRY_USER || github.actor }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: printf %s "$REGISTRY_TOKEN" | podman login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
- name: Vendor upstream images
run: |
org=$(just --evaluate base_image_org)
name=$(just --evaluate base_image_name)
ver=$(just fedora_version --image aurora --tag "$TAG" --flavor main)
akmods=ghcr.io/ublue-os/akmods:$(just akmods_flavor --tag "$TAG")-$ver
refs=("$org/$name:$ver" "$akmods")
if kernel=$(skopeo --registries-conf /dev/null inspect --no-tags --retry-times 3 "docker://$akmods" | jq -er '.Labels["ostree.linux"]'); then
refs+=("$akmods-$kernel")
fi
mapfile -t pinned < <(yq -r '.images[] | select(.name != "kinoite") | "\(.image):\(.tag)@\(.digest)"' image-versions.yml)
.forgejo/vendor-images.sh "${refs[@]}" "${pinned[@]}"
- name: Build
run: >-
env -u GITHUB_TOKEN
GITHUB_REPOSITORY_OWNER=ublue-os
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0='*'
just build --image aurora --tag "$TAG" --flavor main
- name: Push
run: |
built=$(git rev-parse HEAD)
for t in "$TAG" "$TAG-$(date -u +%Y%m%d)" "${built::12}"; do
podman tag "localhost/aurora:$TAG" "$IMAGE:$t"
podman push --retry 5 "$IMAGE:$t"
done
- name: Upload the build's RPMs
continue-on-error: true
env:
REGISTRY_USER: ${{ vars.REGISTRY_USER || github.actor }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
fedora=$(ls -d /var/tmp/buildah-cache-0/*/fedora-*/ 2>/dev/null | head -1)
[ -n "$fedora" ] || { echo "::warning::no dnf cache under /var/tmp/buildah-cache-0"; exit 0; }
.forgejo/upload-rpms.sh "$(dirname "$fedora")"
- name: Clean up
if: always()
run: |
podman logout "$REGISTRY" || true
podman image prune -af >/dev/null || true