Update registration is not disabled when KV store says its disabled b… #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Production Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| production-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| # Skip if the commit message contains the auto-increment marker to prevent infinite loops | |
| if: "!contains(github.event.head_commit.message, '🤖 Auto-increment version')" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Update versions using comprehensive management script | |
| id: version_update | |
| run: | | |
| # Make script executable | |
| chmod +x .github/scripts/manage-versions.js | |
| # Run the comprehensive version management script | |
| node .github/scripts/manage-versions.js | |
| # Display updated files | |
| echo "Updated projectData.ts:" | |
| cat apps/web/projectData.ts | |
| echo "" | |
| echo "Updated version.json:" | |
| cat version.json | |
| - name: Check for changes | |
| id: git_status | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit version changes | |
| if: steps.git_status.outputs.changes == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| # Add all changed files | |
| git add apps/web/projectData.ts version.json | |
| # Add version file if it was created | |
| if [ -n "${{ steps.version_update.outputs.version_file }}" ]; then | |
| git add "Versions/${{ steps.version_update.outputs.version_file }}" | |
| fi | |
| git commit -m "🤖 Auto-increment version to ${{ steps.version_update.outputs.new_version }} (prod: ${{ steps.version_update.outputs.prod_version }}, dev: ${{ steps.version_update.outputs.dev_version }})" | |
| git push | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest | |
| type=raw,value=${{ steps.version_update.outputs.new_version }} | |
| type=raw,value=${{ steps.version_update.outputs.prod_version }},enable={{isBranch 'master'}} | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=sha,prefix= | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Create version branch (stable releases only) | |
| if: steps.git_status.outputs.changes == 'true' && steps.version_update.outputs.is_stable == 'true' && steps.version_update.outputs.is_master == 'true' | |
| run: | | |
| # Create a new branch for this stable version | |
| git checkout -b "release/v${{ steps.version_update.outputs.new_version }}" | |
| git push origin "release/v${{ steps.version_update.outputs.new_version }}" | |
| # Switch back to main branch | |
| git checkout ${{ github.ref_name }} | |
| - name: Generate release notes (stable releases only) | |
| if: steps.git_status.outputs.changes == 'true' && steps.version_update.outputs.is_stable == 'true' && steps.version_update.outputs.is_master == 'true' | |
| id: release_notes | |
| run: | | |
| # Make script executable | |
| chmod +x .github/scripts/generate-release-notes.js | |
| # Generate release notes using the script | |
| node .github/scripts/generate-release-notes.js "${{ steps.version_update.outputs.new_version }}" | |
| - name: Create Git Tag (stable releases only) | |
| if: steps.git_status.outputs.changes == 'true' && steps.version_update.outputs.is_stable == 'true' && steps.version_update.outputs.is_master == 'true' | |
| run: | | |
| git tag v${{ steps.version_update.outputs.new_version }} | |
| git push origin v${{ steps.version_update.outputs.new_version }} | |
| - name: Create GitHub Release (stable releases only) | |
| if: steps.git_status.outputs.changes == 'true' && steps.version_update.outputs.is_stable == 'true' && steps.version_update.outputs.is_master == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Use version file if created, otherwise use generated release notes | |
| if [ -f "Versions/${{ steps.version_update.outputs.version_file }}" ]; then | |
| NOTES_FILE="Versions/${{ steps.version_update.outputs.version_file }}" | |
| else | |
| NOTES_FILE="release-notes.md" | |
| fi | |
| # Create release using GitHub CLI | |
| gh release create v${{ steps.version_update.outputs.new_version }} \ | |
| --title "Release v${{ steps.version_update.outputs.new_version }}" \ | |
| --notes-file "$NOTES_FILE" \ | |
| --latest | |
| - name: Output summary | |
| run: | | |
| echo "## 🚀 Production Release Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Previous version:** ${{ steps.version_update.outputs.previous_version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **New version:** ${{ steps.version_update.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Production version:** ${{ steps.version_update.outputs.prod_version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Development version:** ${{ steps.version_update.outputs.dev_version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Stable release:** ${{ steps.version_update.outputs.is_stable }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 🐳 Docker Images Built" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_update.outputs.new_version }}\`" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.version_update.outputs.is_master }}" == "true" ]; then | |
| echo "- \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_update.outputs.prod_version }}\`" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 📁 Files Updated" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`apps/web/projectData.ts\` - Updated to ${{ steps.version_update.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`version.json\` - prod: ${{ steps.version_update.outputs.prod_version }}, dev: ${{ steps.version_update.outputs.dev_version }}" >> $GITHUB_STEP_SUMMARY | |
| if [ -n "${{ steps.version_update.outputs.version_file }}" ]; then | |
| echo "- \`Versions/${{ steps.version_update.outputs.version_file }}\` - New version file created" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.version_update.outputs.is_stable }}" == "true" ] && [ "${{ steps.version_update.outputs.is_master }}" == "true" ]; then | |
| echo "### 🏷️ Release Created" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Tag:** \`v${{ steps.version_update.outputs.new_version }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Branch:** \`release/v${{ steps.version_update.outputs.new_version }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Release:** [v${{ steps.version_update.outputs.new_version }}](https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version_update.outputs.new_version }})" >> $GITHUB_STEP_SUMMARY | |
| if [ -n "${{ steps.version_update.outputs.version_file }}" ]; then | |
| echo "- **Version File:** \`Versions/${{ steps.version_update.outputs.version_file }}\`" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| else | |
| echo "### ⚠️ Development Build" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.version_update.outputs.is_master }}" != "true" ]; then | |
| echo "This is a development branch build. No GitHub release or version branch created." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "This is a pre-release version (contains alpha, beta, canary, etc.). No GitHub release or version branch created." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| fi |