Files
hypr-chrome/.gitea/workflows/version-bump.yml
T
darmanandClaude Sonnet 5 9acfd2b946
Version Bump / check-bump-label (pull_request) Skipped
Version Bump / apply-version-bump (pull_request) Successful in 23s
Move plugin version into .env, fix version-bump workflow to only touch it
The old workflow grepped CMakeLists.txt for the first "VERSION X.Y" match,
which was cmake_minimum_required's own version rather than the project's,
mangling it to 3.27.0.0 on the first real bump. PLUGIN_VERSION in .env is
now the single source of truth for both CMakeLists.txt and flake.nix, and
the workflow's bump/commit steps only ever touch that one file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 00:02:19 +02:00

90 lines
2.9 KiB
YAML

name: Version Bump
on:
pull_request:
branches: [develop]
types: [opened, synchronize, reopened, labeled, unlabeled, closed]
permissions:
contents: write
jobs:
# Register this job's name as a required status check on develop's branch
# protection - that's what actually blocks the merge button.
check-bump-label:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: Require a bump/major, bump/minor, bump/patch, or bump/skip label
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
echo "$LABELS" | grep -qE '"bump/(major|minor|patch|skip)"' || {
echo "::error::PR into develop must carry one of bump/major, bump/minor, bump/patch, bump/skip"
exit 1
}
# Runs once, after the merge has already happened, to commit the actual
# version bump onto develop.
apply-version-bump:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.CI_BOT_TOKEN }}
- name: Determine bump level from PR labels
id: level
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
for lvl in major minor patch skip; do
if echo "$LABELS" | grep -q "\"bump/$lvl\""; then
echo "level=$lvl" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "::error::merged PR into develop has no bump/major, bump/minor, bump/patch, or bump/skip label"
exit 1
- name: Bump PLUGIN_VERSION in .env
if: steps.level.outputs.level != 'skip'
env:
LEVEL: ${{ steps.level.outputs.level }}
run: |
set -euo pipefail
CURRENT=$(sed -n 's/^PLUGIN_VERSION=//p' .env)
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
case "$LEVEL" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
*) echo "::error::unknown bump level '$LEVEL'"; exit 1 ;;
esac
NEW="$MAJOR.$MINOR.$PATCH"
sed -i "s/^PLUGIN_VERSION=.*/PLUGIN_VERSION=${NEW}/" .env
echo "CURRENT_VERSION=${CURRENT}" >> "$GITHUB_ENV"
echo "NEW_VERSION=${NEW}" >> "$GITHUB_ENV"
- name: Commit and push
if: steps.level.outputs.level != 'skip'
run: |
set -euo pipefail
if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then
echo "::error::version did not change (${CURRENT_VERSION} -> ${NEW_VERSION})"
exit 1
fi
git config user.name "gitea-actions"
git config user.email "actions@noreply.localhost"
git add .env
git commit -m "Bump PLUGIN_VERSION to ${NEW_VERSION}"
git push origin HEAD:develop