feat(scripts): add CI utilities for versioning and changelog

- Add scripts to detect version changes and generate changelogs
- Include setup for installing and configuring git-cliff
- Automate release creation and changelog updates for CI workflows
- Improve Git author setup for consistent commits
This commit is contained in:
2025-06-14 18:36:15 +02:00
parent 14f0a9b4b1
commit 048b964204
6 changed files with 240 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
CHANGELOG_FILE="CHANGELOG.md"
CLIFF_CONFIG="cliff.toml"
GIT_BRANCH="${GITHUB_REF##refs/heads/}"
# === Step 1: Generate Changelog (only if file exists or on main) ===
if [[ -f "$CHANGELOG_FILE" || "$GIT_BRANCH" == "main" ]]; then
echo "📄 Generating $CHANGELOG_FILE using git-cliff..."
git-cliff -c "$CLIFF_CONFIG" -o "$CHANGELOG_FILE"
else
echo "ℹ️ $CHANGELOG_FILE does not exist and branch is not 'main'. Skipping generation."
exit 0
fi
# === Step 2: Commit and push changes if any ===
git add "$CHANGELOG_FILE"
if git diff --cached --quiet; then
echo "✅ No changes to commit – changelog is up to date."
else
echo "✍️ Committing updated $CHANGELOG_FILE..."
git commit -m "chore(changelog): update unreleased changelog"
echo "🚀 Pushing to origin/$GIT_BRANCH..."
git push origin "$GIT_BRANCH"
fi