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)