summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml37
-rwxr-xr-xbuild_files/build.sh12
-rwxr-xr-xbuild_files/patch-bazzite-os-branch-select.sh23
3 files changed, 69 insertions, 3 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c662b02..404bdbd 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -322,3 +322,40 @@ jobs:
with:
release_tag: ${{ needs.build_push.outputs.release_tag }}
handwritten: ${{ inputs.handwritten }}
+
+ kickoff_gamemode_news:
+ name: Refresh Game Mode announcements
+ needs: [generate_release]
+ if: github.ref_name == github.event.repository.default_branch || github.ref_name == 'testing'
+ runs-on: ubuntu-24.04
+ permissions:
+ contents: read
+ steps:
+ - name: Resolve announcement branch
+ id: target
+ run: |
+ branch="${GITHUB_REF_NAME}"
+ [[ "${branch}" == "main" ]] && branch="stable"
+ echo "branch=${branch}" >> "$GITHUB_OUTPUT"
+
+ - name: Check dispatch token
+ id: token
+ env:
+ DISPATCH_PAT: ${{ secrets.PAT }}
+ run: |
+ if [[ -z "${DISPATCH_PAT}" ]]; then
+ echo "::warning::Skipping Game Mode announcements dispatch: configure the PAT secret."
+ echo "available=false" >> "$GITHUB_OUTPUT"
+ else
+ echo "available=true" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Kickoff Game Mode announcements
+ if: steps.token.outputs.available == 'true'
+ uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4
+ continue-on-error: true
+ with:
+ token: ${{ secrets.PAT }}
+ repository: AeroCore-IO/aerocore-os-gamemode-news
+ event-type: build-announcements
+ client-payload: '{"branch": "${{ steps.target.outputs.branch }}"}'
diff --git a/build_files/build.sh b/build_files/build.sh
index 1875ddf..94a5ef5 100755
--- a/build_files/build.sh
+++ b/build_files/build.sh
@@ -14,17 +14,23 @@ esac
# Copy the contents of system_files/ of the git repo to /
cp -avf "/ctx/system_files"/. /
-# Keep Bazzite's game mode news hook unchanged; only switch its feed URL.
+# Keep Bazzite's game mode news hook unchanged; select the matching feed branch.
NEWS_HOOK_CONFIG=/etc/gamemode-news-hook.conf
if [[ ! -f "${NEWS_HOOK_CONFIG}" ]]; then
echo "Unable to locate game mode news hook config: ${NEWS_HOOK_CONFIG}" >&2
exit 1
fi
+NEWS_BRANCH="${IMAGE_BRANCH:-stable}"
+case "${NEWS_BRANCH}" in
+ testing|unstable) ;;
+ *) NEWS_BRANCH=stable ;;
+esac
+NEWS_FEED_URL="https://git.mirror.aerocore.com.cn/AeroCore-IO/aerocore-os-gamemode-news/plain/announcements.json?h=${NEWS_BRANCH}"
sed -i \
- 's|^github = .*|github = https://git.mirror.aerocore.com.cn/AeroCore-IO/aerocore-os-gamemode-news/plain/announcements.json?h=testing|' \
+ "s|^github = .*|github = ${NEWS_FEED_URL}|" \
"${NEWS_HOOK_CONFIG}"
grep -Fxq \
- 'github = https://git.mirror.aerocore.com.cn/AeroCore-IO/aerocore-os-gamemode-news/plain/announcements.json?h=testing' \
+ "github = ${NEWS_FEED_URL}" \
"${NEWS_HOOK_CONFIG}"
# Bazzite's Kinoite/Plasma desktop shortcut used to start a privileged
diff --git a/build_files/patch-bazzite-os-branch-select.sh b/build_files/patch-bazzite-os-branch-select.sh
index 544b1a5..a360a2e 100755
--- a/build_files/patch-bazzite-os-branch-select.sh
+++ b/build_files/patch-bazzite-os-branch-select.sh
@@ -33,3 +33,26 @@ awk -v old="$old" '
install -m 0755 "$patched_file" "$file"
rm -f "$patched_file"
+
+# Match the channel names used by Bazzite's Game Mode announcement feeds.
+# Steam's rc/beta and bc/main aliases still select the same image branches.
+python3 - "$file" <<'PY'
+from pathlib import Path
+import sys
+
+path = Path(sys.argv[1])
+text = path.read_text()
+replacements = {
+ " testing)\n echo rc\n": " testing)\n echo beta\n",
+ " unstable)\n echo main\n": " unstable)\n echo preview\n",
+ " echo rc\n echo beta\n echo bc\n echo main\n":
+ " echo rc\n echo beta\n echo bc\n echo preview\n echo main\n",
+ " bc|main|unstable)\n": " bc|preview|main|unstable)\n",
+}
+for old in replacements:
+ if text.count(old) != 1:
+ raise SystemExit(f"Bazzite branch selector changed; expected exactly one {old!r}")
+for old, new in replacements.items():
+ text = text.replace(old, new, 1)
+path.write_text(text)
+PY