mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
When v$VERSION is released, move the latest tag and release to it and replace its bundle, so the older install URL keeps giving the newest version.
89 lines
3.8 KiB
YAML
89 lines
3.8 KiB
YAML
# 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, and the "latest" tag and
|
|
# release are moved to it, so both of these always get the newest version:
|
|
# curl -fsSL https://github.com/theupriser/cachyos-gamescope-boot/releases/latest/download/setup-gamescope-boot.sh | bash
|
|
# curl -fsSL https://github.com/theupriser/cachyos-gamescope-boot/releases/download/latest/setup-gamescope-boot.sh | bash
|
|
# Pull requests only build and check it, and warn when VERSION is already released.
|
|
name: Single-file build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
bundle:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # for the version in the bundle's header
|
|
|
|
- name: Build
|
|
run: .github/tools/bundle.sh dist/setup-gamescope-boot.sh
|
|
|
|
- name: Check
|
|
run: |
|
|
bash -n dist/setup-gamescope-boot.sh
|
|
# SC2034/SC2154: variables used across the inlined modules.
|
|
shellcheck -S warning -e SC2034,SC2154 dist/setup-gamescope-boot.sh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: setup-gamescope-boot
|
|
path: dist/setup-gamescope-boot.sh
|
|
|
|
- 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" '
|
|
$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 the newest version with:
|
|
|
|
curl -fsSL https://github.com/${{ github.repository }}/releases/latest/download/setup-gamescope-boot.sh | bash
|
|
|
|
## Changes in v$VERSION
|
|
$changes"
|
|
gh release create "v$VERSION" dist/setup-gamescope-boot.sh \
|
|
--target "$GITHUB_SHA" --title "v$VERSION" --notes "$notes" --latest
|
|
|
|
# "latest" follows the newest version tag, for the older install URL
|
|
# (.../releases/download/latest/...). Only moved when a new version
|
|
# is released, never for a push without a VERSION bump.
|
|
git tag -f latest "$GITHUB_SHA" && git push -f origin latest
|
|
latest_notes="Always the newest version, currently v$VERSION (see its release for the changes)."
|
|
if gh release view latest >/dev/null 2>&1; then
|
|
gh release edit latest --title "Latest (v$VERSION)" --notes "$latest_notes" --latest=false
|
|
else
|
|
gh release create latest --title "Latest (v$VERSION)" --notes "$latest_notes" --latest=false
|
|
fi
|
|
gh release upload latest dist/setup-gamescope-boot.sh --clobber
|