🔄 fix: move version bump before Swagger generation

This commit is contained in:
2026-04-07 08:49:45 +02:00
parent 4ffaa6191d
commit fd7ade77b8

View File

@@ -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