fix(ci): bump patch for all release channels

This commit is contained in:
Mitchell R 2026-05-21 02:02:20 +02:00
parent 96f5e6a330
commit 251b076b99
No known key found for this signature in database

View file

@ -1,14 +1,13 @@
# Single entrypoint for release automation. # Single entrypoint for release automation.
# #
# Triggers: # Triggers:
# - push to master → auto-tag (semver patch bump + -dev.<sha>), # - push to master → auto-tag next patch from latest tag + -dev.<sha>,
# create prerelease, invoke build.yml # create prerelease, invoke build.yml
# - push of v* tag → use tag as-is, create release (or update), # - push of v* tag → infer channel from tag, auto-tag next patch,
# invoke build.yml; channel = stable / beta # create release (or update), invoke build.yml
# #
# Build steps live in build.yml (reusable). This file only owns versioning # Build steps live in build.yml (reusable). This file only owns versioning
# + release creation. Skip the heavy image build for dev runs (binary only) # + release creation. Every channel builds the kiosk binary and Pi image.
# so master pushes don't take 30 min; tag pushes do the full image.
name: release name: release
@ -57,33 +56,41 @@ jobs:
short=$(git rev-parse --short HEAD) short=$(git rev-parse --short HEAD)
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
tag="${GITHUB_REF#refs/tags/}" requested_tag="${GITHUB_REF#refs/tags/}"
version="${tag#v}" requested_version="${requested_tag#v}"
if [[ "$version" == *"-beta."* ]]; then if [[ "$requested_version" == *"-beta"* ]]; then
channel=beta channel=beta
elif [[ "$version" == *"-dev."* ]]; then elif [[ "$requested_version" == *"-dev"* ]]; then
channel=dev channel=dev
else else
channel=stable channel=stable
fi fi
build_image=true
else else
# Master push (or workflow_dispatch). Find latest stable tag, channel=dev
# bump patch, append -dev.<sha>. Prerelease. fi
# Stable, beta, and dev all advance the patch number per build.
latest=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname \ latest=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname \
| grep -v '-' | head -1 || true) | head -1 || true)
if [ -z "$latest" ]; then latest="v0.0.0"; fi if [ -z "$latest" ]; then latest="v0.0.0"; fi
base="${latest#v}" base="${latest#v}"
base="${base%%-*}"
IFS=. read -r MAJ MIN PAT <<< "$base" IFS=. read -r MAJ MIN PAT <<< "$base"
PAT=$((PAT + 1)) PAT=$((PAT + 1))
case "$channel" in
stable)
version="${MAJ}.${MIN}.${PAT}"
;;
beta)
version="${MAJ}.${MIN}.${PAT}-beta.${short}"
;;
dev)
version="${MAJ}.${MIN}.${PAT}-dev.${short}" version="${MAJ}.${MIN}.${PAT}-dev.${short}"
;;
esac
tag="v${version}" tag="v${version}"
channel=dev
# Every release — including dev — ships the flashable .img.xz.
# Public repo = unlimited Actions minutes, so the 30-60 min image
# bake on every master push costs nothing.
build_image=true build_image=true
fi
echo "version=$version" >> "$GITHUB_OUTPUT" echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT" echo "tag=$tag" >> "$GITHUB_OUTPUT"
@ -98,8 +105,9 @@ jobs:
CHANNEL: ${{ steps.compute.outputs.channel }} CHANNEL: ${{ steps.compute.outputs.channel }}
run: | run: |
set -e set -e
# For master / dispatch we need to create the tag ourselves. # The workflow computes the release tag for all channels so every
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then # build bumps the patch version. A pushed tag only selects channel.
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
git config user.email "actions@github.com" git config user.email "actions@github.com"
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git tag -a "$TAG" -m "Auto-tag $TAG ($CHANNEL)" git tag -a "$TAG" -m "Auto-tag $TAG ($CHANNEL)"