Verified Commit 021ce947 authored by Adrian DC's avatar Adrian DC
Browse files

chore(mise): create 'changelog' task to generate with 'git-cliff'

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
Generated-by: git-project-factory 3.0.0-9-g39d3557
parent 3867f113
Loading
Loading
Loading
Loading
+x+54
Changes for .mise/tasks/sources/changelog: 54 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env bash

# Mise
#MISE alias="changelog"
#MISE description="Generate sources changelog"

# Arguments
release_tag="${1:-${RELEASE_TAG}}"

# Request release tag
echo ' '
echo -n ' > Current commit : '
git describe --always
echo ' '
if [ ! -z "${release_tag:-}" ]; then
  tag="${release_tag}"
else
  read -p ' > Release tag [ENTER to skip tag]: ' -r tag
fi
echo ' '

# Prepare release tag
if [ ! -z "${tag}" ]; then
  git tag -f -m "${tag}" "${tag}"
fi

# Detect configuration
config='./conf/git-cliff/cliff.toml'
for path in ./conf/git-cliff/cliff.toml ./config/cliff.toml ./conf/cliff.toml; do
  if [ -e "${path}" ]; then
    config="${path}"
    break
  fi
done

# Generate changelog
git-cliff --no-exec --config "${config}" --output ./CHANGELOG.md
if [ ! -z "${tag}" ]; then
  sed -i "s#raw/[^/]*/docs#raw/${tag}/docs#g" ./README.md
fi
git add -v ./CHANGELOG.md ./README.md
echo ' '
if [ ! -z "${tag}" ]; then
  git commit -m "docs(changelog): release version ${tag} and refresh changes history" -s
else
  version=$(git describe --abbrev=7 --always --long --tags)
  git commit -m "docs(changelog): update to ${version} and refresh changes history" -s
fi
echo ' '

# Create release tag
if [ ! -z "${tag}" ]; then
  git tag -f -m "${tag}" "${tag}"
fi
+3 −2
Changes for conf/git-cliff/cliff.toml: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -79,8 +79,9 @@ commit_parsers = [
  { message = "^chore",    group = "<!-- 09 -->⚙️ Cleanups" },
  { message = "^ci",       group = "<!-- 10 -->🚀 CI" },
  { message = "^build",    group = "<!-- 11 -->📦 Build" },
  { message = "^revert",   group = "<!-- 12 -->◀️ Revert" },
  { message = "^wip",      group = "<!-- 13 -->🚧 WIP" },
  { message = "^deps",     group = "<!-- 12 -->🧩 Dependencies" },
  { message = "^revert",   group = "<!-- 13 -->◀️ Revert" },
  { message = "^wip",      group = "<!-- 14 -->🚧 WIP" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
+1
Changes for mise.toml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
[tools]
git-cliff = "latest"
"pipx:gitlabci-local" = "latest"
"pipx:pre-commit-crocodile" = "latest"