From fd7ade77b8c10a56637269c9023b2591d176e012 Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Tue, 7 Apr 2026 08:49:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20fix:=20move=20version=20bump=20b?= =?UTF-8?q?efore=20Swagger=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-cd.yaml | 55 ++++++++++++++----------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/.gitea/workflows/ci-cd.yaml b/.gitea/workflows/ci-cd.yaml index f9f913d..b1d7643 100644 --- a/.gitea/workflows/ci-cd.yaml +++ b/.gitea/workflows/ci-cd.yaml @@ -164,6 +164,26 @@ jobs: - name: Install swag (once) run: go install github.com/swaggo/swag/cmd/swag@latest + - name: Version bump (main branch only) + if: github.ref == 'refs/heads/main' + run: | + # Analyze last commit message + LAST_COMMIT=$(git log -1 --pretty=%B | head -1) + + # Automatic version bump based on commit type + if echo "$LAST_COMMIT" | grep -q "^✨ feat:"; then + echo "🎯 Feature commit detected - bumping MINOR version" + ./scripts/version-bump.sh minor + elif echo "$LAST_COMMIT" | grep -q "^🐛 fix:"; then + echo "🐛 Fix commit detected - bumping PATCH version" + ./scripts/version-bump.sh patch + elif echo "$LAST_COMMIT" | grep -q "BREAKING CHANGE"; then + echo "💥 Breaking change detected - bumping MAJOR version" + ./scripts/version-bump.sh major + else + echo "⏭️ No automatic version bump needed" + fi + - name: Generate Swagger Docs run: | if [ "${{ env.CACHE_AVAILABLE }}" = "true" ]; then @@ -226,40 +246,7 @@ jobs: # path: pkg/server/docs/swagger.json # retention-days: 1 - # Version management and Docker build (main branch only) - - name: Version management and Docker build - if: github.ref == 'refs/heads/main' - run: | - # Analyze last commit message - LAST_COMMIT=$(git log -1 --pretty=%B | head -1) - VERSION_BUMPED="false" - - # Automatic version bump based on commit type - if echo "$LAST_COMMIT" | grep -q "^✨ feat:"; then - echo "🎯 Feature commit detected - bumping MINOR version" - ./scripts/version-bump.sh minor - VERSION_BUMPED="true" - elif echo "$LAST_COMMIT" | grep -q "^🐛 fix:"; then - echo "🐛 Fix commit detected - bumping PATCH version" - ./scripts/version-bump.sh patch - VERSION_BUMPED="true" - elif echo "$LAST_COMMIT" | grep -q "BREAKING CHANGE"; then - echo "💥 Breaking change detected - bumping MAJOR version" - ./scripts/version-bump.sh major - VERSION_BUMPED="true" - else - echo "⏭️ No automatic version bump needed" - fi - - # Update swagger version regardless of bump - source VERSION - NEW_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" - sed -i "s|// @version [0-9.]*|// @version $NEW_VERSION|" cmd/server/main.go - - # Handle version bump using script - export PACKAGES_TOKEN="${{ secrets.PACKAGES_TOKEN }}" - ./scripts/ci-version-bump.sh "$LAST_COMMIT" - + # Docker build and push (main branch only) - name: Login to Gitea Container Registry if: github.ref == 'refs/heads/main' uses: docker/login-action@v3