Files
BetterDesk/.github/workflows/version-bump-dev.yml
T
UNITRONIX 144dafc94c fix(ci): restore direct version bumps; keep only main locked
Remove PR-based bump flow. Branch protection on `dev` is cleared so
operators and github-actions can push/merge freely; `main` stays
fully protected (PR + reviews + required checks).

Thanks: INSOLVE (Honorary); betterde.sk (@trybetterdesk) (Bronze); Marco Jakobs (@jacotec); MyNameisStitch (@MyNameisStitch); Redspin (@playerumpknow); muopc (@muopc)
2026-11-22 22:23:07 +01:00

86 lines
3.2 KiB
YAML

# =============================================================================
# BetterDesk — automatic patch version bump on dev branch
# =============================================================================
# Every push to `dev` (except version-bump commits) bumps product version +0.0.1
# across Tier 1/2 files via scripts/bump-version.js, then pushes directly.
# `dev` is intentionally lightly protected so GITHUB_TOKEN can push bumps;
# `main` stays fully protected (PR + reviews + checks).
#
# After a successful bump push, explicitly dispatch docker-publish (tag=dev).
# GITHUB_TOKEN branch pushes do not re-trigger other workflows (#401).
# =============================================================================
name: Version Bump (dev)
on:
push:
branches: [dev]
permissions:
contents: write
actions: write
concurrency:
group: version-bump-dev
cancel-in-progress: false
jobs:
bump-patch:
# Skip only real auto-bump commits (subject line), not feature messages that
# happen to mention the marker in the body.
if: |
!startsWith(github.event.head_commit.message, 'chore: bump version') &&
!startsWith(github.event.head_commit.message, 'chore: release version')
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: '24'
- name: Bump patch version
id: bump
run: |
node scripts/bump-version.js --patch
NEW_VERSION=$(cat VERSION | tr -d '\n')
echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
- name: Commit and push version bump
id: commit
env:
NEW_VERSION: ${{ steps.bump.outputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add $(node scripts/bump-version.js --list-paths)
if git diff --cached --quiet; then
echo "No version files changed — skipping commit"
echo "pushed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git commit -m "chore: bump version to ${NEW_VERSION} [version-bump]"
for attempt in 1 2 3 4 5; do
if git push origin HEAD:dev; then
echo "pushed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Push failed (attempt ${attempt}/5) — rebasing and retrying..."
git pull --rebase origin dev
done
echo "Version bump push failed after retries"
exit 1
- name: Trigger GHCR :dev image publish
if: steps.commit.outputs.pushed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Explicit dispatch — bump commits from GITHUB_TOKEN do not start workflows.
gh workflow run .github/workflows/docker-publish.yml --ref dev -f tag=dev
echo "Dispatched docker-publish for :dev (VERSION ${{ steps.bump.outputs.version }})"