Specific River Gallery section #161 #87
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: Deploy Preview App | |
| on: | |
| pull_request: | |
| # This will also run when the PR is closed to clean up the preview app on fly. | |
| types: [closed] | |
| workflow_call: | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| FLY_REGION: syd | |
| FLY_ORG: projects-aucc | |
| jobs: | |
| preview_app: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| url: ${{ steps.deploy.outputs.url }} | |
| # We could configure custom preview environments for each PR, but this is a bit more | |
| # complex and require a bit more work, and not necessary for now. We also need elevated | |
| # permissions if we wish to tear down environments when the PR is closed. | |
| # environment: | |
| # name: preview | |
| # url: ${{ steps.deploy.outputs.url }} | |
| steps: | |
| - name: Get code | |
| uses: actions/checkout@v4 | |
| - name: Get Environment Secrets | |
| uses: Infisical/[email protected] | |
| with: | |
| method: 'universal' | |
| client-id: ${{ secrets.INFISICAL_CLIENT_ID }} | |
| client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }} | |
| domain: 'https://app.infisical.com' | |
| env-slug: 'dev' | |
| project-slug: 'aucc-website' | |
| - name: Deploy PR app to Fly.io | |
| id: deploy | |
| uses: superfly/fly-pr-review-apps@latest | |
| with: | |
| name: aucc-preview-pr-${{ github.event.number }} | |
| config: fly.preview.toml | |
| secrets: >- | |
| SKIP_ENV_VALIDATION="true" | |
| DATABASE_URL="${{ env.DATABASE_URL }}" | |
| PAYLOAD_SECRET="${{ env.PAYLOAD_SECRET}}" | |
| SERVER_URL="https://aucc-preview-pr-${{ github.event.number }}.fly.dev" | |
| S3_BUCKET="${{ env.S3_BUCKET}}" | |
| S3_ACCESS_KEY_ID="${{ env.S3_ACCESS_KEY_ID}}" | |
| S3_SECRET_ACCESS_KEY="${{ env.S3_SECRET_ACCESS_KEY}}" | |
| S3_REGION="${{ env.S3_REGION}}" | |
| NEXT_PUBLIC_CF_URL="${{ env.NEXT_PUBLIC_CF_URL}}" | |
| API_KEY="${{ env.API_KEY}}" | |
| build_secrets: >- | |
| DATABASE_URL=${{ env.DATABASE_URL }} | |
| PAYLOAD_SECRET=${{ env.PAYLOAD_SECRET}} | |
| SERVER_URL=https://aucc-preview-pr-${{ github.event.number }}.fly.dev | |
| S3_BUCKET=${{ env.S3_BUCKET}} | |
| S3_ACCESS_KEY_ID=${{ env.S3_ACCESS_KEY_ID}} | |
| S3_SECRET_ACCESS_KEY=${{ env.S3_SECRET_ACCESS_KEY}} | |
| S3_REGION=${{ env.S3_REGION}} | |
| NEXT_PUBLIC_CF_URL=${{ env.NEXT_PUBLIC_CF_URL}} | |
| API_KEY=${{ env.API_KEY}} | |
| - name: Skip comment for closed PRs | |
| if: github.event.action == 'closed' | |
| run: echo "PR is closed, skipping comment creation" && exit 0 | |
| - name: Find Comment | |
| uses: peter-evans/find-comment@v3 | |
| id: fc | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: Preview deployment is live | |
| - name: Update PR Comment with Preview URL | |
| uses: peter-evans/create-or-update-comment@v4 | |
| # This will only run if the comment was not found to prevent duplicate comments | |
| if: steps.fc.outputs.comment-id == '' | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: '🚀 Preview deployment is live: [Preview Link](${{ steps.deploy.outputs.url }})' | |
| reactions: rocket | |
| token: ${{ secrets.GITHUB_TOKEN }} |