ci: A release per version (tag v0.7.0, ...) instead of overwriting "latest"

- Publish release v$VERSION with its CHANGELOG.md section; never overwrite an existing version.
- Pull requests warn when VERSION is already released.
- Install URL: releases/latest/download/setup-gamescope-boot.sh (newest release).
This commit is contained in:
theupriser committed 2026-09-24 10:07:56 +02:00
1 parent b469324fbd
commit 04891ee2cd
4 files changed
+44 -25

No files matched your search

+31 -20
View File
@@ -1,7 +1,9 @@
# Builds the single-file wizard (.github/tools/bundle.sh) and publishes it as the
# asset of the rolling "latest" release, for:
# curl -fsSL https://github.com/theupriser/cachyos-gamescope-boot/releases/download/latest/setup-gamescope-boot.sh | bash
# Pull requests only build and check it.
# Builds the single-file wizard (.github/tools/bundle.sh) and publishes it as a
# release per version: tag v$VERSION (VERSION in setup-gamescope-boot.sh),
# with that version's CHANGELOG.md section as notes. A released version is
# never overwritten; the newest one is marked latest, so this always gets it:
# curl -fsSL https://github.com/theupriser/cachyos-gamescope-boot/releases/latest/download/setup-gamescope-boot.sh | bash
# Pull requests only build and check it, and warn when VERSION is already released.
name: Single-file build
on:
@@ -35,29 +37,38 @@ jobs:
name: setup-gamescope-boot
path: dist/setup-gamescope-boot.sh
- name: Publish to the "latest" release
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
- name: Version
id: version
env:
GH_TOKEN: ${{ github.token }}
run: |
version="$(grep -oP '^VERSION=\K.*' setup-gamescope-boot.sh)"
echo "version=$version" >> "$GITHUB_OUTPUT"
if gh release view "v$version" >/dev/null 2>&1; then
echo "released=true" >> "$GITHUB_OUTPUT"
echo "::warning::v$version is already released and won't be overwritten. Bump VERSION in setup-gamescope-boot.sh and add a CHANGELOG.md section to release this."
else
echo "released=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish the v${{ steps.version.outputs.version }} release
if: >-
github.event_name != 'pull_request' && github.ref == 'refs/heads/main' &&
steps.version.outputs.released == 'false'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
# This version's section of CHANGELOG.md, without its heading.
changes="$(awk -v v="$version" '
changes="$(awk -v v="$VERSION" '
$0 ~ "^## " { if (found) exit; if (index($0, "## " v " ") == 1) { found = 1; next } }
found' CHANGELOG.md)"
notes="Single-file build of v$version ($(git describe --always), $(git log -1 --format=%cs)).
Run it with:
notes="Single-file build of v$VERSION ($(git describe --always), $(git log -1 --format=%cs)).
Run the newest version with:
curl -fsSL https://github.com/${{ github.repository }}/releases/download/latest/setup-gamescope-boot.sh | bash
curl -fsSL https://github.com/${{ github.repository }}/releases/latest/download/setup-gamescope-boot.sh | bash
## Changes in v$version
## Changes in v$VERSION
$changes"
title="Latest single-file build (v$version)"
if gh release view latest >/dev/null 2>&1; then
gh release edit latest --title "$title" --notes "$notes"
else
gh release create latest --title "$title" --notes "$notes" --latest
fi
# Move the tag to this commit and replace the asset.
git tag -f latest && git push -f origin latest
gh release upload latest dist/setup-gamescope-boot.sh --clobber
gh release create "v$VERSION" dist/setup-gamescope-boot.sh \
--target "$GITHUB_SHA" --title "v$VERSION" --notes "$notes" --latest