From 46486801656dbc2e8bbb4f944d13d9115d418966 Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Wed, 8 Apr 2026 15:56:22 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20feat:=20implement=20single=20pus?= =?UTF-8?q?h=20with=20multiple=20commits=20approach?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .gitea/workflows/ci-cd.yaml | 54 ++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/ci-cd.yaml b/.gitea/workflows/ci-cd.yaml index 6eba584..040ed46 100644 --- a/.gitea/workflows/ci-cd.yaml +++ b/.gitea/workflows/ci-cd.yaml @@ -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)