🤖 feat: implement single push with multiple commits approach

- Use original ci-update-coverage-badge.sh for individual badge commits
- Add version bump automation for main branch
- Single push at the end for all commits
- Follows gitmoji style with [skip ci] where appropriate

This implements the correct approach:
- Multiple commits (BDD, Unit, Version) in one step
- Single push at the end
- Proper commit messages with gitmoji
- [skip ci] to prevent loops
This commit is contained in:
2026-04-08 15:56:22 +02:00
parent 9d42909b86
commit 4648680165

View File

@@ -236,38 +236,48 @@ jobs:
# path: pkg/server/docs/swagger.json
# retention-days: 1
# Single badge update step using environment variables (KISS approach)
# Badge updates should run on all branches to keep documentation accurate
- name: Update all badges (single commit)
# Badge and version updates - multiple commits, single push
# All documentation updates happen in one step with single push at the end
- name: Update badges and version (multiple commits, single push)
if: always() && github.actor != 'ci-bot'
run: |
echo "🎯 Updating all badges using environment variables..."
echo "🎯 Updating badges and version..."
echo "BDD Coverage: ${DLC_BDD_COVERAGE:-Not set}"
echo "Unit Coverage: ${DLC_UNIT_COVERAGE:-Not set}"
# Configure git
git config user.name "CI Bot"
git config user.email "ci@arcodange.fr"
# Extract coverage values (remove % sign)
BDD_COV=${DLC_BDD_COVERAGE%"%"}
UNIT_COV=${DLC_UNIT_COVERAGE%"%"}
# Update badges only if values are set
if [ -n "$BDD_COV" ] || [ -n "$UNIT_COV" ]; then
./scripts/update-all-badges.sh "$BDD_COV" "$UNIT_COV"
# Configure git
git config user.name "CI Bot"
git config user.email "ci@arcodange.fr"
git add README.md
# Commit only if there are changes
if git commit -m "🤖 chore: update coverage badges [skip ci]"; then
echo "✅ Badges updated, committing changes..."
git push
echo "🎉 Successfully pushed badge updates"
else
echo " No badge changes to commit"
fi
# Update BDD coverage badge if value is set
if [ -n "$BDD_COV" ]; then
echo "📊 Updating BDD coverage badge to ${BDD_COV}%"
./scripts/ci-update-coverage-badge.sh "$BDD_COV" "bdd"
fi
# Update Unit coverage badge if value is set
if [ -n "$UNIT_COV" ]; then
echo "📊 Updating Unit coverage badge to ${UNIT_COV}%"
./scripts/ci-update-coverage-badge.sh "$UNIT_COV" "unit"
fi
# Check for version bump on main branch
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "🔖 Checking for version bump..."
./scripts/version-bump-auto.sh
fi
# Single push for all commits
if [ -n "$(git status --porcelain)" ]; then
echo "💾 Changes detected, pushing all commits..."
git push
echo "🎉 Successfully pushed all updates"
else
echo " No coverage data available to update badges"
echo " No changes to push"
fi
# Docker build and push (main branch only)