mirror of
https://codeberg.org/secana/Forji.git
synced 2026-06-16 05:13:55 -07:00
ci: add automatic changelog creation
This commit is contained in:
parent
ad35a6f4f7
commit
d580156fa2
4 changed files with 98 additions and 10 deletions
|
|
@ -5,8 +5,6 @@ All notable changes to Forji will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.5] - 2026-06-04
|
||||
|
||||
### Added
|
||||
|
|
@ -41,6 +39,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- No longer opens a duplicate PR when the reviewer request fails (#53).
|
||||
- Background notification poll no longer crashes on an invalid instance URL (#54).
|
||||
- Messages that were not marked as read are now handled correctly.
|
||||
|
||||
[Unreleased]: https://codeberg.org/secana/Forji/compare/v1.5...HEAD
|
||||
[1.5]: https://codeberg.org/secana/Forji/releases/tag/v1.5
|
||||
|
|
|
|||
54
cliff.toml
Normal file
54
cliff.toml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# git-cliff configuration — generates CHANGELOG.md from conventional commits.
|
||||
# Output follows the Keep a Changelog format (https://keepachangelog.com/en/1.1.0/).
|
||||
# See https://git-cliff.org/docs/configuration
|
||||
|
||||
[changelog]
|
||||
header = """
|
||||
# Changelog
|
||||
|
||||
All notable changes to Forji will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
|
||||
"""
|
||||
body = """
|
||||
{% if version -%}
|
||||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% else -%}
|
||||
## [Unreleased]
|
||||
{% endif -%}
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in commits %}
|
||||
- {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
|
||||
{% endfor %}
|
||||
{% endfor %}\n
|
||||
"""
|
||||
footer = ""
|
||||
# Remove leading and trailing whitespaces from the changelog's body.
|
||||
trim = true
|
||||
|
||||
[git]
|
||||
# Parse commits according to the conventional commits specification.
|
||||
conventional_commits = true
|
||||
# Drop commits that are not conventional (e.g. merge commits).
|
||||
filter_unconventional = true
|
||||
# Drop commits that no parser assigns to a group.
|
||||
filter_commits = true
|
||||
# Only consider tags that look like releases (v1.5, v1.6, ...).
|
||||
tag_pattern = "v[0-9]*"
|
||||
sort_commits = "oldest"
|
||||
# Groups render alphabetically; "Added" < "Changed" < "Fixed" already matches
|
||||
# the Keep a Changelog ordering for the types we emit.
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "Added" },
|
||||
{ message = "^fix", group = "Fixed" },
|
||||
{ message = "^refactor", group = "Changed" },
|
||||
{ message = "^perf", group = "Changed" },
|
||||
{ message = "^docs", group = "Changed" },
|
||||
{ message = "^chore", skip = true },
|
||||
{ message = "^test", skip = true },
|
||||
{ message = "^style", skip = true },
|
||||
{ message = "^ci", skip = true },
|
||||
{ message = "^build", skip = true },
|
||||
]
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
pkgs.xcbeautify
|
||||
pkgs.swiftlint
|
||||
pkgs.swiftformat
|
||||
pkgs.git-cliff
|
||||
];
|
||||
};
|
||||
});
|
||||
|
|
|
|||
48
justfile
48
justfile
|
|
@ -37,11 +37,49 @@ pbxproj := "Forji/Forji.xcodeproj/project.pbxproj"
|
|||
version:
|
||||
@grep -m1 'MARKETING_VERSION' {{pbxproj}} | sed 's/.*= *//;s/;.*//'
|
||||
|
||||
# Set app version (updates both MARKETING_VERSION and CURRENT_PROJECT_VERSION)
|
||||
set-version new_version:
|
||||
sed -i '' 's/MARKETING_VERSION = [^;]*/MARKETING_VERSION = {{new_version}}/' {{pbxproj}}
|
||||
sed -i '' 's/CURRENT_PROJECT_VERSION = [^;]*/CURRENT_PROJECT_VERSION = {{new_version}}/' {{pbxproj}}
|
||||
@echo "Version set to {{new_version}}"
|
||||
changelog := "CHANGELOG.md"
|
||||
|
||||
# Preview the changelog entries for unreleased commits (since the latest tag)
|
||||
changelog:
|
||||
@git cliff --config cliff.toml --unreleased --strip header
|
||||
|
||||
# Release a new version: bump version, generate the changelog, tag, commit, and push
|
||||
release new_version:
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
NEW="{{new_version}}"
|
||||
TAG="v$NEW"
|
||||
|
||||
# Refuse to release from a dirty tree so the release commit stays clean.
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Working tree is not clean. Commit or stash your changes before releasing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Refuse to clobber an existing tag.
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PREV=$(grep -m1 'MARKETING_VERSION' {{pbxproj}} | sed 's/.*= *//;s/;.*//')
|
||||
echo "Releasing $PREV -> $NEW"
|
||||
|
||||
# 1. Bump the version in the Xcode project.
|
||||
sed -i '' "s/MARKETING_VERSION = [^;]*/MARKETING_VERSION = $NEW/" {{pbxproj}}
|
||||
sed -i '' "s/CURRENT_PROJECT_VERSION = [^;]*/CURRENT_PROJECT_VERSION = $NEW/" {{pbxproj}}
|
||||
|
||||
# 2. Generate the changelog section for the new version from the conventional
|
||||
# commits since the last tag, prepending it under the header.
|
||||
git cliff --config cliff.toml --unreleased --tag "$TAG" --prepend {{changelog}}
|
||||
|
||||
# 3. Commit, tag, and push.
|
||||
git add {{pbxproj}} {{changelog}}
|
||||
git commit -m "chore: release $NEW"
|
||||
git tag -a "$TAG" -m "Release $NEW"
|
||||
git push origin HEAD
|
||||
git push origin "$TAG"
|
||||
echo "Released $NEW and pushed $TAG."
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
|
|
|
|||
Loading…
Reference in a new issue