chore: rework release pipeline to tag-based releases with changelog in PR (#269)

Co-authored-by: Meliox <na>
This commit is contained in:
Meliox 2026-08-09 13:12:47 +02:00 committed by GitHub
parent 282af3231d
commit b423d60da4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,9 +2,9 @@ name: Open / Update Version Bump PR
# Triggered when any PR merges to main touching src/ or debian/ (push), # Triggered when any PR merges to main touching src/ or debian/ (push),
# or when a bump:* label is added to the chore/version-bump PR (labeled). # or when a bump:* label is added to the chore/version-bump PR (labeled).
# Accumulates changes in CHANGES.md, writes debian/changelog with the correct # On push: recreates the branch from main and collects all commits since the
# bumped version, and keeps the PR body up to date. # last tag — no incremental accumulation, no rebase, no conflicts.
# On label change the changelog entry is rewritten with the new version. # On label change: checks out the existing branch and rewrites the changelog entry.
on: on:
push: push:
@ -38,42 +38,33 @@ jobs:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Collect new commits (push only)
id: new_commits
if: github.event_name == 'push'
run: |
LOG=$(git log "HEAD~1..HEAD" --oneline -- src/ | head -50)
EOF=$(openssl rand -hex 16)
echo "log<<$EOF" >> "$GITHUB_OUTPUT"
echo "$LOG" >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Set up chore/version-bump branch - name: Set up chore/version-bump branch
env:
NEW_COMMITS: ${{ steps.new_commits.outputs.log }}
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 fetch origin main git fetch origin main
if git fetch origin chore/version-bump 2>/dev/null; then
git checkout chore/version-bump
git rebase origin/main
else
git checkout -b chore/version-bump origin/main
fi
if [[ "${{ github.event_name }}" == "push" ]]; then if [[ "${{ github.event_name }}" == "push" ]]; then
# Always recreate from main — avoids rebase conflicts after PR merge
git checkout -b chore/version-bump origin/main
# Collect all commits touching src/ since the last release tag
LAST_TAG=$(git describe --tags --abbrev=0 origin/main 2>/dev/null || true)
if [[ -n "$LAST_TAG" ]]; then
LOG=$(git log "${LAST_TAG}..origin/main" --oneline -- src/ | head -50)
else
LOG=$(git log origin/main --oneline -- src/ | head -50)
fi
mkdir -p .github/version-bump mkdir -p .github/version-bump
PREV=$(cat .github/version-bump/CHANGES.md 2>/dev/null || true) echo "${LOG:-No src/ changes since last release.}" > .github/version-bump/CHANGES.md
{
echo "${NEW_COMMITS:-No src/ changes detected.}"
[[ -n "$PREV" ]] && echo "$PREV"
} > .github/version-bump/CHANGES.md
git add .github/version-bump/CHANGES.md git add .github/version-bump/CHANGES.md
MAIN_SHA=$(git rev-parse --short origin/main) git commit -m "chore: collect changes since ${LAST_TAG:-initial}"
git commit -m "chore: accumulate changes from ${MAIN_SHA}" git push --force origin chore/version-bump
git push --force-with-lease origin chore/version-bump else
# Label change: check out the existing branch, no CHANGES.md update
git fetch origin chore/version-bump
git checkout chore/version-bump
fi fi
- name: Determine bump type - name: Determine bump type