change build to tags

This commit is contained in:
Meliox 2026-08-09 12:15:12 +02:00
parent d59d36eceb
commit 25a0355326
2 changed files with 13 additions and 14 deletions

View File

@ -1,15 +1,12 @@
name: Build and Release name: Build and Release
# Triggered when debian/changelog changes on main — meaning version-bump.yml # Triggered when version-bump.yml pushes a vX.Y.Z tag.
# just committed a new version. Builds the .deb, signs it, and publishes a GitHub Release. # Builds the .deb, signs it, and publishes a GitHub Release.
# The actor guard ensures this only fires for the bot's changelog commit.
on: on:
push: push:
branches: tags:
- main - 'v*'
paths:
- 'debian/changelog'
permissions: permissions:
contents: write contents: write
@ -22,6 +19,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
with: with:
ref: ${{ github.ref }}
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -2,9 +2,8 @@ name: Version Bump
# Triggered when the chore/version-bump PR is merged to main. # Triggered when the chore/version-bump PR is merged to main.
# Reads the bump:patch / bump:minor / bump:major label from the merged PR. # Reads the bump:patch / bump:minor / bump:major label from the merged PR.
# Updates debian/changelog and commits to main. # Updates debian/changelog, commits it, and pushes a vX.Y.Z tag.
# Cleans up the CHANGES.md accumulator file in the same commit. # release.yml triggers on that tag push and builds the release.
# release.yml picks up the changelog change and builds the release.
on: on:
pull_request: pull_request:
@ -51,7 +50,9 @@ jobs:
env: env:
BUMP_TYPE: ${{ steps.bump_type.outputs.type }} BUMP_TYPE: ${{ steps.bump_type.outputs.type }}
run: | run: |
CURRENT=$(grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/') # Prefer latest tag; fall back to debian/changelog on first run
CURRENT=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' \
|| grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/')
MAJOR=$(echo "$CURRENT" | cut -d. -f1) MAJOR=$(echo "$CURRENT" | cut -d. -f1)
MINOR=$(echo "$CURRENT" | cut -d. -f2) MINOR=$(echo "$CURRENT" | cut -d. -f2)
PATCH=$(echo "$CURRENT" | cut -d. -f3) PATCH=$(echo "$CURRENT" | cut -d. -f3)
@ -98,12 +99,12 @@ jobs:
} > debian/changelog.new } > debian/changelog.new
mv debian/changelog.new debian/changelog mv debian/changelog.new debian/changelog
- name: Commit changelog and clean up accumulator - name: Commit and tag
run: | run: |
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release/v${{ steps.version.outputs.new }}
git add debian/changelog git add debian/changelog
git rm --ignore-unmatch .github/version-bump/CHANGES.md git rm --ignore-unmatch .github/version-bump/CHANGES.md
git commit -m "Release v${{ steps.version.outputs.new }}" git commit -m "Release v${{ steps.version.outputs.new }}"
git push -u origin release/v${{ steps.version.outputs.new }} git tag v${{ steps.version.outputs.new }}
git push origin v${{ steps.version.outputs.new }}