CHANGELOG.md is now auto-generated from commit messages by git-cliff in
the release workflow. Hand-edits below the static header will be wiped on
the next tag.
Workflow (`.github/workflows/release.yml`):
- On tag push (`v[0-9]+.[0-9]+.[0-9]+`):
1. Render GitHub Release body: `git-cliff --latest --strip header`
→ just the per-version section, no SemVer preamble repeat
2. Regenerate full CHANGELOG.md: `git-cliff` (default = all tags)
→ preserves header + all historical sections
3. Commit CHANGELOG.md back to master with `[skip ci]` marker
4. Publish GitHub Release with the latest-only body
Template (`cliff.toml`):
- `[changelog].header` now holds the SemVer preamble + CalVer→SemVer
mapping table (preserved across regens; stripped from GitHub Release
bodies via `--strip header`).
- `body` template now renders the **full commit message** (subject as
bold bullet, body indented below) instead of just the first line.
Rich narrative I write in commit message bodies (tables, validation
numbers, before/after diffs) now flows into both CHANGELOG.md and the
GitHub Release page from the same source.
- Per-release Pin/Diff footer guarded with `{% if version %}` so the
Unreleased section doesn't emit empty links.
CHANGELOG.md replaced with the auto-gen output. Past hand-written tables
and phase breakdowns are replaced by the corresponding commit messages
(those were already rich for commits that mattered — v0.3.1 soak-helper
fix has its Before/After table in the commit body and renders fine).
Going forward: just write rich commit messages and tag. Both surfaces
update automatically. No hand-edit of CHANGELOG.md required.
77 lines
2.7 KiB
YAML
77 lines
2.7 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # full history needed for git-cliff
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# ---- (1) Generate the GitHub Release body (latest only, no header) ----
|
|
# `--strip header` drops the static SemVer preamble so the release page
|
|
# shows just the per-version section, while CHANGELOG.md (below) keeps
|
|
# the header at the top of the file.
|
|
- name: Generate release notes (latest only)
|
|
id: cliff-release
|
|
uses: orhun/git-cliff-action@v4
|
|
with:
|
|
config: cliff.toml
|
|
args: --latest --strip header --github-repo noonghunna/club-3090
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
OUTPUT: RELEASE_NOTES.md
|
|
|
|
# ---- (2) Regenerate full CHANGELOG.md (all tags, with header) ----
|
|
- name: Regenerate CHANGELOG.md
|
|
uses: orhun/git-cliff-action@v4
|
|
with:
|
|
config: cliff.toml
|
|
args: --github-repo noonghunna/club-3090
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
OUTPUT: CHANGELOG.md
|
|
|
|
# ---- (3) Commit the regenerated CHANGELOG.md back to master ----
|
|
# The tag's commit doesn't include this auto-regen — but the GitHub
|
|
# Release page is correct (step 1), and master's CHANGELOG.md catches
|
|
# up ~1 min after tag push. Skipped if nothing changed.
|
|
- name: Commit CHANGELOG.md back to master
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git fetch origin master
|
|
git checkout -B master origin/master
|
|
# Re-run cliff against master HEAD so the regen reflects what master
|
|
# actually contains (the tag may not yet be on master if pushed from
|
|
# a feature branch; uncommon but handled).
|
|
git add CHANGELOG.md
|
|
if git diff --staged --quiet; then
|
|
echo "CHANGELOG.md unchanged — skipping commit."
|
|
else
|
|
git commit -m "chore(changelog): regenerate for ${{ github.ref_name }} [skip ci]"
|
|
git push origin master
|
|
fi
|
|
|
|
# ---- (4) Publish GitHub Release ----
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ github.ref_name }}
|
|
body_path: RELEASE_NOTES.md
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|