-
-
Notifications
You must be signed in to change notification settings - Fork 229
ci(release): pin tags and fill changelog #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
davidbudnick
merged 3 commits into
AprilNEA:master
from
davidbudnick:ci/release-plz-tag-and-changelog
Aug 9, 2026
+226
−25
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Whole-repo changelog (git-cliff). release-plz only bumps versions; it is | ||
| # package-path-scoped and cannot see `release = false` app crates, so the root | ||
| # CHANGELOG is owned here — same model as GoReleaser's `changelog.use: git`. | ||
| # https://git-cliff.org/docs/configuration | ||
|
|
||
| [changelog] | ||
| header = """# Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| """ | ||
| # Keep-a-Changelog layout matching historical OpenLogi sections. | ||
| body = """ | ||
| ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} | ||
|
|
||
| {% for group, commits in commits | group_by(attribute="group") -%} | ||
| ### {{ group | upper_first }} | ||
|
|
||
| {% for commit in commits -%} | ||
| - {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} | ||
| {% endfor %} | ||
| {% endfor -%} | ||
| """ | ||
| trim = true | ||
|
|
||
| [git] | ||
| conventional_commits = true | ||
| filter_unconventional = true | ||
| require_conventional = true | ||
| split_commits = false | ||
| commit_preprocessors = [ | ||
| { pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/AprilNEA/OpenLogi/pull/${1}))" }, | ||
| ] | ||
| commit_parsers = [ | ||
| { message = "^feat", group = "Added" }, | ||
| { message = "^fix", group = "Fixed" }, | ||
| { message = "^perf", group = "Changed" }, | ||
| { message = "^security", group = "Security" }, | ||
| { message = "^.*", skip = true }, | ||
| ] | ||
| protect_breaking_commits = true | ||
| filter_commits = false | ||
| tag_pattern = "v[0-9].*" | ||
| sort_commits = "newest" | ||
| # No include_path / exclude_path — every conventional commit since the last tag | ||
| # counts, including gui/agent work that never touches a crates.io package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/usr/bin/env bash | ||
| # Write the next workspace version section into CHANGELOG.md with git-cliff. | ||
| # Whole-repo conventional commits since the previous v* tag (cliff.toml). | ||
| set -euo pipefail | ||
|
|
||
| root="$(git rev-parse --show-toplevel)" | ||
| cd "$root" | ||
|
|
||
| version="$( | ||
| python3 - <<'PY' | ||
| import pathlib, re, sys | ||
| text = pathlib.Path("Cargo.toml").read_text() | ||
| m = re.search(r'(?ms)^\[workspace\.package\].*?^version\s*=\s*"([^"]+)"', text) | ||
| if not m: | ||
| sys.exit("workspace.package version not found in Cargo.toml") | ||
| print(m.group(1)) | ||
| PY | ||
| )" | ||
| tag="v${version}" | ||
|
|
||
| last_tag="$( | ||
| git tag --list 'v*' \ | ||
| | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \ | ||
| | sort -V \ | ||
| | tail -n1 | ||
| )" | ||
| if [[ -z "${last_tag}" ]]; then | ||
| echo "error: no previous vX.Y.Z tag" >&2 | ||
| exit 1 | ||
| fi | ||
| if [[ "${last_tag}" == "${tag}" ]]; then | ||
| echo "error: workspace version ${version} is already tagged as ${tag}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Drop a stale section for this version (idempotent re-runs / release-pr updates). | ||
| if grep -qE "^## \[${version}\]" CHANGELOG.md; then | ||
| python3 - "${version}" <<'PY' | ||
| from pathlib import Path | ||
| import re | ||
| import sys | ||
|
|
||
| version = sys.argv[1] | ||
| text = Path("CHANGELOG.md").read_text() | ||
| pattern = re.compile( | ||
| rf"(?ms)^## \[{re.escape(version)}\].*?(?=^## \[|\Z)" | ||
| ) | ||
| Path("CHANGELOG.md").write_text(pattern.sub("", text, count=1)) | ||
| PY | ||
| fi | ||
|
|
||
| git cliff "${last_tag}.." \ | ||
| --config cliff.toml \ | ||
| --tag "${tag}" \ | ||
| --prepend CHANGELOG.md | ||
|
|
||
| echo "wrote ${tag} changelog from ${last_tag}..HEAD" >&2 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.