diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9db61d7..983c258 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,12 @@ name: Build and Release -# Triggered when debian/changelog changes on main — meaning version-bump.yml -# just committed a new version. Builds the .deb, signs it, and publishes a GitHub Release. -# The actor guard ensures this only fires for the bot's changelog commit. +# Triggered when version-bump.yml pushes a vX.Y.Z tag. +# Builds the .deb, signs it, and publishes a GitHub Release. on: push: - branches: - - main - paths: - - 'debian/changelog' + tags: + - 'v*' permissions: contents: write @@ -22,6 +19,7 @@ jobs: steps: - uses: actions/checkout@v7 with: + ref: ${{ github.ref }} fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 2f66d1c..68a6fff 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -2,9 +2,8 @@ name: Version Bump # Triggered when the chore/version-bump PR is merged to main. # Reads the bump:patch / bump:minor / bump:major label from the merged PR. -# Updates debian/changelog and commits to main. -# Cleans up the CHANGES.md accumulator file in the same commit. -# release.yml picks up the changelog change and builds the release. +# Updates debian/changelog, commits it, and pushes a vX.Y.Z tag. +# release.yml triggers on that tag push and builds the release. on: pull_request: @@ -51,7 +50,9 @@ jobs: env: BUMP_TYPE: ${{ steps.bump_type.outputs.type }} 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) MINOR=$(echo "$CURRENT" | cut -d. -f2) PATCH=$(echo "$CURRENT" | cut -d. -f3) @@ -98,12 +99,12 @@ jobs: } > debian/changelog.new mv debian/changelog.new debian/changelog - - name: Commit changelog and clean up accumulator + - name: Commit and tag run: | git config user.name "github-actions[bot]" 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 rm --ignore-unmatch .github/version-bump/CHANGES.md git commit -m "Release v${{ steps.version.outputs.new }}" - git push -u origin release/v${{ steps.version.outputs.new }} \ No newline at end of file + git tag v${{ steps.version.outputs.new }} + git push origin v${{ steps.version.outputs.new }} \ No newline at end of file