mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 05:13:01 +03:00
chore: use git cliff for release notes
This commit is contained in:
1802
CHANGELOG.md
1802
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
49
cliff.toml
Normal file
49
cliff.toml
Normal file
@@ -0,0 +1,49 @@
|
||||
# git-cliff ~ configuration file
|
||||
# https://git-cliff.org/docs/configuration
|
||||
|
||||
[remote.github]
|
||||
owner = "pocket-id"
|
||||
repo = "pocket-id"
|
||||
|
||||
[git]
|
||||
conventional_commits = true
|
||||
filter_unconventional = true
|
||||
commit_preprocessors = [{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }]
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "Features" },
|
||||
{ message = "^fix", group = "Bug Fixes" },
|
||||
{ message = "^docs", group = "Documentation" },
|
||||
{ message = "^perf", group = "Performance Improvements" },
|
||||
{ message = "^release", skip = true },
|
||||
{ message = "update translations via Crowdin", skip = true },
|
||||
{ message = ".*", group = "Other", default_scope = "other"},
|
||||
]
|
||||
filter_commits = false
|
||||
|
||||
[changelog]
|
||||
trim = true
|
||||
body = """
|
||||
## {{ version | default(value="Unknown Version") }}
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | title }}
|
||||
{% for commit in commits %}
|
||||
* {{ commit.message }} \
|
||||
{%- if commit.remote.pr_number -%}
|
||||
([#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) by @{{ commit.remote.username | default(value=commit.author.name) }})
|
||||
{%- else -%}
|
||||
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}) by @{{ commit.remote.username | default(value=commit.author.name) }})
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% if version %}
|
||||
{% if previous.version %}
|
||||
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
|
||||
{% endif %}
|
||||
{% else -%}
|
||||
{% raw %}\n{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
"""
|
||||
@@ -4,15 +4,10 @@ if [ ! -f .version ] || [ ! -f frontend/package.json ] || [ ! -f CHANGELOG.md ];
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if conventional-changelog is installed, if not install it
|
||||
if ! command -v conventional-changelog &>/dev/null; then
|
||||
echo "conventional-changelog not found, installing..."
|
||||
npm install -g conventional-changelog-cli
|
||||
# Verify installation was successful
|
||||
if ! command -v conventional-changelog &>/dev/null; then
|
||||
echo "Error: Failed to install conventional-changelog-cli."
|
||||
exit 1
|
||||
fi
|
||||
# Check if git cliff is installed
|
||||
if ! command -v git cliff &>/dev/null; then
|
||||
echo "Error: git cliff is not installed. Please install it from https://git-cliff.org/docs/installation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if GitHub CLI is installed
|
||||
@@ -113,7 +108,7 @@ git add frontend/package.json
|
||||
|
||||
# Generate changelog
|
||||
echo "Generating changelog..."
|
||||
conventional-changelog -p conventionalcommits -i CHANGELOG.md -s --pkg frontend/package.json
|
||||
git cliff --github-token=$(gh auth token) --prepend CHANGELOG.md --tag "v$NEW_VERSION" --unreleased
|
||||
git add CHANGELOG.md
|
||||
|
||||
# Commit the changes with the new version
|
||||
@@ -128,7 +123,7 @@ git push --tags
|
||||
|
||||
# Extract the changelog content for the latest release
|
||||
echo "Extracting changelog content for version $NEW_VERSION..."
|
||||
CHANGELOG=$(awk '/^## / {if (NR > 1) exit} NR > 1 {print}' CHANGELOG.md | awk 'NR > 2 || NF {print}')
|
||||
CHANGELOG=$(awk '/^## v[0-9]/ { if (found) exit; found=1; next } found' CHANGELOG.md)
|
||||
|
||||
if [ -z "$CHANGELOG" ]; then
|
||||
echo "Error: Could not extract changelog for version $NEW_VERSION."
|
||||
|
||||
Reference in New Issue
Block a user