From ff0ec9f11e7c59d58b01f16b758affde8876c54a Mon Sep 17 00:00:00 2001 From: rickpeters Date: Tue, 29 Sep 2026 21:39:00 +0200 Subject: [PATCH] feat(ci): ISO releases start on GitHub (tag + notes, iso-release.yml); the Gitea mirror builds on that tag and attaches the ISO (a release on the mirror survives its syncs only with a tag from GitHub); steamify-prepare.sh takes an exact STEAMIFY_VERSION --- .github/workflows/iso-release.yml | 61 ++++++++++++++++++++++++ .github/workflows/steamify-iso.yml | 74 +++++++++++++++++------------- CHANGELOG.md | 1 + steamify-prepare.sh | 12 +++-- 4 files changed, 111 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/iso-release.yml diff --git a/.github/workflows/iso-release.yml b/.github/workflows/iso-release.yml new file mode 100644 index 0000000..a9643e3 --- /dev/null +++ b/.github/workflows/iso-release.yml @@ -0,0 +1,61 @@ +# The Steamify ISO's release, step 1 of 2 (GitHub): names it and creates its tag and a release with the notes. +# The Gitea mirror (git.upriser.nl) gets the tag with its next sync (triggered here when GITEA_TOKEN is set), +# builds the ISO on that tag and attaches it to its own release for it (steamify-iso.yml). The ISO lives there: +# GitHub releases take at most 2 GB per file, the ISO is bigger, and a release on the mirror only survives its +# syncs when its tag comes from here. +# Name: the Steamify version the ISO gets (its newest release) plus the time: master releases +# v-- (UTC), feat/steamify a pre-release v-dev.-. +name: Steamify ISO release (tag) + +on: + push: + branches: [master, feat/steamify] + workflow_dispatch: + +permissions: + contents: write + +env: + GITEA_URL: https://git.upriser.nl + GITEA_REPO: theupriser/steamify-cachyos-live-iso + +jobs: + tag: + if: github.server_url == 'https://github.com' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Tag and release + env: + GH_TOKEN: ${{ github.token }} + run: | + steamify="$(gh release view -R theupriser/steamify-cachyos --json tagName -q .tagName)" + steamify="${steamify#v}" + stamp="$(date -u +%Y.%m.%d-%H%M)" + if [ "${{ github.ref }}" = refs/heads/master ]; then + tag="v$steamify-$stamp" pre="" name="CachyOS with Steamify Live ISO $steamify ($stamp UTC)" + else + tag="v$steamify-dev.$stamp" pre="--prerelease" name="CachyOS with Steamify Live ISO $steamify (test build $stamp UTC)" + fi + # The Steamify section of CHANGELOG.md ("## CachyOS with Steamify Live ISO"), without its heading. + section="$(awk '/^## CachyOS with Steamify Live ISO/ {found = 1; next} found && /^#/ {exit} found' CHANGELOG.md)" + notes="The ISO is built from \`$(git rev-parse --short HEAD)\` (${{ github.ref_name }}) with Steamify $steamify and published on the mirror (GitHub releases take at most 2 GB per file); it appears there within minutes of the mirror's sync: + + **Download: $GITEA_URL/$GITEA_REPO/releases/tag/$tag** + + Sources: [Steamify](https://github.com/theupriser/steamify-cachyos/tree/v$steamify), this repository at this tag, and the packages' sources at [CachyOS](https://github.com/CachyOS) and [Arch Linux](https://archlinux.org/packages/). + + $section" + gh release create "$tag" --target "$GITHUB_SHA" $pre --title "$name" --notes "$notes" + echo "Released $tag" + + # Optional: sync the mirror at once instead of at its interval (a Gitea token with repository write + # access as the secret GITEA_TOKEN). + - name: Sync the Gitea mirror + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + if [ -z "$GITEA_TOKEN" ]; then echo "No GITEA_TOKEN: the mirror picks the tag up at its next sync."; exit 0; fi + curl -fsS -X POST -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/repos/$GITEA_REPO/mirror-sync" && + echo "Mirror sync started" diff --git a/.github/workflows/steamify-iso.yml b/.github/workflows/steamify-iso.yml index 7b292a3..eb78c5b 100644 --- a/.github/workflows/steamify-iso.yml +++ b/.github/workflows/steamify-iso.yml @@ -1,20 +1,20 @@ -# The Steamify ISO, built and released on the Gitea mirror (git.upriser.nl) by its own runner: the same -# build as by hand (the wsl-build-host skill in steamify-cachyos-dev), then a Gitea release with the ISO, -# its checksums and package list, notes from CHANGELOG.md's Steamify section. The ISO's version is the -# Steamify version on it plus the build date and time (UTC): master releases v--, -# feat/steamify a pre-release v-dev.-. Never overwritten. GitHub skips it (one file -# for both servers; GitHub releases take at most 2 GB per file, the ISO is bigger). +# The Steamify ISO's release, step 2 of 2 (the Gitea mirror, git.upriser.nl, on its own runner): builds the +# ISO for a release tag that iso-release.yml created on GitHub (it comes in with the mirror's sync, and a +# release on the mirror only survives its syncs when its tag comes from GitHub), then attaches the ISO, its +# checksums and package list to the mirror's release for that tag. The tag names the Steamify version and +# the time: v-- (master) or v-dev.<...> (feat/steamify, a pre-release); +# the ISO gets exactly that Steamify release, and its label the same moment. GitHub skips it. # The runner needs privileged containers (archiso mounts loop devices) and ~20 GB of disk; Gitea's -# [attachment] MAX_SIZE must allow the ISO (default 2 GB). +# [repository.release] FILE_MAX_SIZE must allow the ISO (default 2 GB). name: Steamify ISO (Gitea release) on: push: - branches: [master, feat/steamify] + tags: ['v*'] workflow_dispatch: concurrency: - group: steamify-iso + group: steamify-iso-${{ github.ref }} cancel-in-progress: true jobs: @@ -38,11 +38,21 @@ jobs: with: fetch-depth: 0 - - name: Steamify on the ISO (its newest release) + - name: Version and time from the tag run: | - ./steamify-prepare.sh - # One moment for the ISO's label (profiledef.sh) and the release's name. - echo "STEAMIFY_BUILD_STAMP=$(date -u +%Y%m%d_%H%M)" >> "$GITHUB_ENV" + tag="${{ github.ref_name }}" + [[ "$tag" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)-(dev\.)?([0-9]{4})\.([0-9]{2})\.([0-9]{2})-([0-9]{4})$ ]] || + { echo "::error::$tag is not a Steamify ISO release tag (v-[dev.]-)"; exit 1; } + m=("${BASH_REMATCH[@]}") + { + echo "STEAMIFY_VERSION=${m[1]}" + # One moment for the ISO's label (profiledef.sh) and the release's name: the tag's. + echo "STEAMIFY_BUILD_STAMP=${m[3]}${m[4]}${m[5]}_${m[6]}" + echo "ISO_PRERELEASE=$([ -n "${m[2]}" ] && echo true || echo false)" + } >> "$GITHUB_ENV" + + - name: Steamify ${{ env.STEAMIFY_VERSION }} on the ISO + run: ./steamify-prepare.sh - name: Build run: | @@ -57,44 +67,42 @@ jobs: run: | iso="$(ls out/desktop/*.iso | head -n 1)" [ -f "$iso" ] || { echo "::error::no ISO in out/desktop"; exit 1; } - steamify="$(sed -n 's/^VERSION=//p' archiso/airootfs/usr/local/share/steamify/steamify.sh | head -n 1)" - [ -n "$steamify" ] || { echo "::error::no Steamify version on the ISO"; exit 1; } - api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}" - exists() { curl -fsS -o /dev/null -H "Authorization: token $TOKEN" "$api/releases/tags/$1"; } - b="$STEAMIFY_BUILD_STAMP" # YYYYMMDD_HHMM (UTC), the same moment as the ISO's label - stamp="${b:0:4}.${b:4:2}.${b:6:2}-${b:9:4}" # every build its own name - if [ "${{ github.ref }}" = refs/heads/master ]; then - tag="v$steamify-$stamp" prerelease=false name="CachyOS with Steamify Live ISO $steamify ($stamp UTC)" + tag="${{ github.ref_name }}" b="$STEAMIFY_BUILD_STAMP" + stamp="${b:0:4}.${b:4:2}.${b:6:2}-${b:9:4}" + if [ "$ISO_PRERELEASE" = true ]; then + name="CachyOS with Steamify Live ISO $STEAMIFY_VERSION (test build $stamp UTC)" else - tag="v$steamify-dev.$stamp" prerelease=true name="CachyOS with Steamify Live ISO $steamify (test build $stamp UTC)" + name="CachyOS with Steamify Live ISO $STEAMIFY_VERSION ($stamp UTC)" fi - # Never overwritten (a rerun in the same minute would find its tag taken). - if exists "$tag"; then - echo "::warning::$tag is already released and won't be overwritten." + # Never overwritten: a release for this tag that already has the ISO is left alone. + api="${{ github.server_url }}/api/v1/repos/${{ github.repository }}" + if curl -fsS -H "Authorization: token $TOKEN" "$api/releases/tags/$tag" -o /tmp/rel.json && + [ "$(jq '[.assets[] | select(.name | endswith(".iso"))] | length' /tmp/rel.json)" -gt 0 ]; then + echo "::warning::$tag already has its ISO and won't be overwritten." echo "publish=false" >> "$GITHUB_OUTPUT"; exit 0 fi - { echo "publish=true"; echo "tag=$tag"; echo "prerelease=$prerelease"; echo "name=$name"; } >> "$GITHUB_OUTPUT" - # The Steamify section of CHANGELOG.md ("## CachyOS with Steamify Live ISO"), without its heading. + { echo "publish=true"; echo "name=$name"; } >> "$GITHUB_OUTPUT" section="$(awk '/^## CachyOS with Steamify Live ISO/ {found = 1; next} found && /^#/ {exit} found' CHANGELOG.md)" { - echo "Built $(date -u '+%F %H:%M UTC') from \`$(git rev-parse --short HEAD)\` (${{ github.ref_name }}), with Steamify $steamify." + echo "Built from \`$(git rev-parse --short HEAD)\` ($tag) with Steamify $STEAMIFY_VERSION." echo - echo "SHA-256: \`$(cut -d' ' -f1 "$iso.sha256")\`, label \`STEAMIFY_${steamify//./_}_$b\`" + echo "SHA-256: \`$(cut -d' ' -f1 "$iso.sha256")\`, label \`STEAMIFY_${STEAMIFY_VERSION//./_}_$b\`" + echo + echo "Sources: [Steamify](https://github.com/theupriser/steamify-cachyos/tree/v$STEAMIFY_VERSION), this repository at this tag, and the packages' sources at [CachyOS](https://github.com/CachyOS) and [Arch Linux](https://archlinux.org/packages/)." echo echo "$section" } > release-notes.md cat release-notes.md - - name: Publish ${{ steps.rel.outputs.tag }} + - name: Publish ${{ github.ref_name }} if: steps.rel.outputs.publish == 'true' uses: akkuman/gitea-release-action@v1.3.7 with: token: ${{ github.token }} - tag_name: ${{ steps.rel.outputs.tag }} - target_commitish: ${{ github.sha }} + tag_name: ${{ github.ref_name }} name: ${{ steps.rel.outputs.name }} body_path: release-notes.md - prerelease: ${{ steps.rel.outputs.prerelease }} + prerelease: ${{ env.ISO_PRERELEASE }} files: | out/desktop/*.iso out/desktop/*.iso.sha256 diff --git a/CHANGELOG.md b/CHANGELOG.md index f700044..af85315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ ## CachyOS with Steamify Live ISO CachyOS 26.08 with Steamify built in: install CachyOS and turn the PC into a Steam Machine in one go. Its version is the Steamify version on it plus the build date and time (a release on `master` is `v--`, e.g. `v2.9.1-2026.09.29-1432`). +Releases: GitHub creates the tag and a release with the notes; the ISO itself (over GitHub's 2 GB limit) is built on the Gitea mirror and attached to its release for that tag (git.upriser.nl). **Features:** diff --git a/steamify-prepare.sh b/steamify-prepare.sh index c133684..f45a60f 100755 --- a/steamify-prepare.sh +++ b/steamify-prepare.sh @@ -2,21 +2,25 @@ # steamify-prepare.sh [steamify checkout]: puts the Steamify bundle on the # ISO (archiso/airootfs/usr/local/share/steamify/steamify.sh), used by the # installer's Steamify step, and what its Steamify page shows (qml/). Built from a checkout when given, else the -# newest release. Run before buildiso.sh. +# newest release, or exactly release $STEAMIFY_VERSION (e.g. 2.9.2: the ISO release workflow, whose tag names +# the version). Run before buildiso.sh. set -euo pipefail +rel="https://github.com/theupriser/steamify-cachyos/releases/${STEAMIFY_VERSION:+download/v$STEAMIFY_VERSION}" +[[ -n "${STEAMIFY_VERSION:-}" ]] || rel+="latest/download" +src_ref="${STEAMIFY_VERSION:+v$STEAMIFY_VERSION}"; src_ref="${src_ref:-main}" dest="$(cd "$(dirname "$0")" && pwd)/archiso/airootfs/usr/local/share/steamify/steamify.sh" mkdir -p "$(dirname "$dest")" if [[ -n "${1:-}" ]]; then (cd "$1" && .github/tools/bundle.sh "$dest") else - curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify.sh -o "$dest" + curl -fsSL "$rel/steamify.sh" -o "$dest" fi # The power-off fix's source, for build-live-modules.sh (live session). poweroff="$(dirname "$dest")/steamify-fremont-poweroff.c" if [[ -n "${1:-}" ]]; then cp "$1/patches/steamify-fremont-poweroff.c" "$poweroff" else - curl -fsSL https://raw.githubusercontent.com/theupriser/steamify-cachyos/main/patches/steamify-fremont-poweroff.c -o "$poweroff" + curl -fsSL "https://raw.githubusercontent.com/theupriser/steamify-cachyos/$src_ref/patches/steamify-fremont-poweroff.c" -o "$poweroff" fi # The installer's Steamify page (/usr/local/share/steamify-installer/ # SteamifyPage.qml) shows the app's explanations (Theme.qml, Texts.qml, from the @@ -27,7 +31,7 @@ rm -rf "$qml"; mkdir -p "$qml" if [[ -n "${1:-}" ]]; then cp "$1"/ui/qml/{Theme,Texts}.qml "$qml/" else - curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify-app.tar.gz | + curl -fsSL "$rel/steamify-app.tar.gz" | tar -xz -C "$qml" --strip-components=2 ui/qml/Theme.qml ui/qml/Texts.qml fi cp "$(cd "$(dirname "$0")" && pwd)/archiso/airootfs/usr/local/share/steamify-installer/Items.qml" "$qml/"