mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 17:56:34 +00:00
fix(ci): bump patch for all release channels
This commit is contained in:
parent
96f5e6a330
commit
251b076b99
1 changed files with 34 additions and 26 deletions
60
.github/workflows/release.yml
vendored
60
.github/workflows/release.yml
vendored
|
|
@ -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,34 +56,42 @@ 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,
|
|
||||||
# bump patch, append -dev.<sha>. Prerelease.
|
|
||||||
latest=$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname \
|
|
||||||
| grep -v '-' | head -1 || true)
|
|
||||||
if [ -z "$latest" ]; then latest="v0.0.0"; fi
|
|
||||||
base="${latest#v}"
|
|
||||||
IFS=. read -r MAJ MIN PAT <<< "$base"
|
|
||||||
PAT=$((PAT + 1))
|
|
||||||
version="${MAJ}.${MIN}.${PAT}-dev.${short}"
|
|
||||||
tag="v${version}"
|
|
||||||
channel=dev
|
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
|
|
||||||
fi
|
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 \
|
||||||
|
| head -1 || true)
|
||||||
|
if [ -z "$latest" ]; then latest="v0.0.0"; fi
|
||||||
|
base="${latest#v}"
|
||||||
|
base="${base%%-*}"
|
||||||
|
IFS=. read -r MAJ MIN PAT <<< "$base"
|
||||||
|
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}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
tag="v${version}"
|
||||||
|
build_image=true
|
||||||
|
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
echo "channel=$channel" >> "$GITHUB_OUTPUT"
|
echo "channel=$channel" >> "$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)"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue