Refactor: First step into Nuxt UI - App shell (#4967) #18
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: 'Deployment (PR and Push to master/maintenance)' | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - master | |
| - '*-maintenance' | |
| push: | |
| branches: | |
| - master | |
| - '*-maintenance' | |
| jobs: | |
| commit_reference: | |
| name: Get Commit Reference | |
| runs-on: ubuntu-latest | |
| outputs: | |
| commit_ref: ${{ steps.set_commit_ref.outputs.commit_ref }} | |
| steps: | |
| - name: Set Commit Reference | |
| id: set_commit_ref | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" ]]; then | |
| COMMIT_REF=${{ github.sha }} | |
| else | |
| COMMIT_REF=${{ github.event.pull_request.head.sha }} | |
| fi | |
| echo "COMMIT_REF=$COMMIT_REF" >> $GITHUB_OUTPUT | |
| # Set a simple output to confirm the value | |
| echo "EVENT: ${{ github.event_name }}, COMMIT_REF=$COMMIT_REF" | |
| # Build the code (minimal secrets here) | |
| build: | |
| name: Build | |
| needs: commit_reference | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| debug_build: ${{ github.event_name == 'pull_request_target' || github.event_name == 'pull_request' }} | |
| commit_ref: ${{ needs.commit_reference.outputs.COMMIT_REF }} | |
| secrets: | |
| RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }} | |
| RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} | |
| RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | |
| RELEASE_KEY_ALIAS_PASSWORD: ${{ secrets.RELEASE_KEY_ALIAS_PASSWORD }} | |
| # Prepare branch name for deployment | |
| prepare_branch: | |
| name: Prepare Branch Name | |
| needs: build | |
| runs-on: ubuntu-latest | |
| outputs: | |
| branch_name: ${{ steps.branch_name.outputs.BRANCH }} | |
| steps: | |
| - name: Set alias branch name for Cloudflare | |
| id: branch_name | |
| run: | | |
| if [[ "${{ github.event_name }}" == "push" ]]; then | |
| BRANCH=${{ github.ref_name }} | |
| else | |
| BRANCH=PR${{ github.event.pull_request.number }} | |
| fi | |
| echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT | |
| # Set a simple output to confirm the value | |
| echo "EVENT: ${{ github.event_name }}, BRANCH: $BRANCH" | |
| # Deploy with secrets (no PR code checkout) | |
| deploy: | |
| name: Deploy | |
| needs: [build, prepare_branch] | |
| uses: ./.github/workflows/deploy_cloudflare.yml | |
| with: | |
| branch_name: ${{ needs.prepare_branch.outputs.branch_name }} | |
| environment_name: ${{ github.ref_name }} | |
| secrets: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| # Add PR comment with deployment links | |
| pr_comment: | |
| name: Add PR Comment | |
| needs: [build, deploy] | |
| if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: Add deployment comment | |
| uses: thollander/actions-comment-pull-request@v3 | |
| with: | |
| message: | | |
| 🎉 Do you want to test this code? 🎉 | |
| - 🌐 **[Progressive Web Application (PWA)](${{ needs.deploy.outputs.deployment_alias_url }})** | |
| - 🤖 **[Android APK](${{ needs.build.outputs.apk_url }})** | |
| ⚠️ **CAUTION**: The build may be unstable and result in corrupted configurations or data loss. Use only for testing! ⚠️ | |
| comment-tag: 'deployment-comment' | |
| mode: recreate |