chore: fix git-cliff

This commit is contained in:
ThetaDev 2024-03-22 03:09:52 +01:00
parent f0b21ed2b4
commit c9f86c31f9
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
2 changed files with 16 additions and 10 deletions

View file

@ -68,22 +68,22 @@ release crate="rustypipe":
VERSION=$(git-cliff $INCLUDES --bumped-version | grep -Po '\d+\.\d+\.\d+$')
echo "Releasing $VERSION:"
# if [ -n "$(git status --porcelain)" ]; then echo "Workdir must be clean"; exit 1; fi
if [ -n "$(git status --porcelain)" ]; then echo "Workdir must be clean"; exit 1; fi
if git rev-parse "${CRATE}/v${VERSION}" >/dev/null 2>&1; then echo "version tag v${VERSION} already exists"; exit 1; fi
cargo semver -c "$CARGO_TOML" set "$VERSION"
CLIFF_ARGS="--tag v${VERSION}"
CLIFF_ARGS="--tag v${VERSION} --unreleased $INCLUDES"
echo "git-cliff $CLIFF_ARGS"
if [ -f "$CHANGELOG" ]; then
CLIFF_ARGS="$CLIFF_ARGS --unreleased $INCLUDES"
CLIFF_OUT="--prepend $CHANGELOG"
git-cliff $CLIFF_ARGS --prepend "$CHANGELOG"
else
CLIFF_OUT="--output $CHANGELOG"
git-cliff $CLIFF_ARGS --output "$CHANGELOG"
fi
echo "git-cliff $CLIFF_ARGS $CLIFF_OUT"
eval "git-cliff $CLIFF_ARGS $CLIFF_OUT"
editor "$CHANGELOG"
git add "$CHANGELOG" "$CARGO_TOML"
git commit -m "chore(release): release $CRATE v$VERSION"
eval "git-cliff $CLIFF_ARGS --strip all" | git tag -a -F - --cleanup whitespace "${CRATE}/v${VERSION}"
awk 'BEGIN{RS="(^|\n)## "} NR==2 { print "##",$0 }' "$CHANGELOG" | git tag -a -F - --cleanup whitespace "${CRATE}/v${VERSION}"

View file

@ -14,8 +14,13 @@ All notable changes to this project will be documented in this file.\n
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% set repo_url = "https://code.thetadev.de/ThetaDev/rustypipe" %}\
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{%if previous.version %}\
## [{{ version }}]({{ repo_url }}/compare/{{ previous.version }}..{{ version }})\
{% else %}\
## {{ version }}\
{% endif %} - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
@ -25,7 +30,8 @@ body = """
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ repo_url }}/commit/{{ commit.id }}))\
{% endfor %}
{% endfor %}\
{% else %}