chore(actions): rename build arg secrets #6
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: Fly Deploy | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| deploy-web: | |
| name: Deploy Web | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy Frontend to Fly.io | |
| run: > | |
| flyctl deploy --remote-only --config fly.toml | |
| --build-arg VITE_FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }} | |
| --build-arg VITE_FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }} | |
| --build-arg VITE_FIREBASE_AUTH_DOMAIN=${{ secrets.FIREBASE_AUTH_DOMAIN }} | |
| --build-arg VITE_FIREBASE_STORAGE_BUCKET=${{ secrets.FIREBASE_STORAGE_BUCKET }} | |
| --build-arg VITE_FIREBASE_APP_ID=${{ secrets.FIREBASE_APP_ID }} | |
| --build-arg VITE_SERVER_URL=${{ secrets.SERVER_URL }} | |
| working-directory: ./frontend | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_PRODUCTION_API_TOKEN }} | |
| deploy-api: | |
| name: Deploy Api | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy Backend to Fly.io | |
| run: flyctl deploy --remote-only --config fly.toml | |
| working-directory: ./backend | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_PRODUCTION_API_TOKEN }} | |
| finalize-deployment: | |
| name: Finalize Deployment | |
| runs-on: ubuntu-latest | |
| needs: [deploy-web, deploy-api] | |
| if: always() | |
| steps: | |
| - name: Create Deployment via GitHub API | |
| id: create | |
| run: | | |
| response=$(curl -s -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| https://api.github.com/repos/${{ github.repository }}/deployments \ | |
| -d '{ | |
| "ref": "${{ github.sha }}", | |
| "environment": "Fly Production", | |
| "required_contexts": [], | |
| "auto_merge": false, | |
| "description": "Deploying frontend and backend to Production" | |
| }') | |
| echo "deployment_id=$(echo $response | jq -r '.id')" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Mark Deployment as Success | |
| if: success() | |
| run: | | |
| curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| https://api.github.com/repos/${{ github.repository }}/deployments/${{ steps.create.outputs.deployment_id }}/statuses \ | |
| -d '{"state": "success"}' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Mark Deployment as Failure | |
| if: failure() | |
| run: | | |
| curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| https://api.github.com/repos/${{ github.repository }}/deployments/${{ steps.create.outputs.deployment_id }}/statuses \ | |
| -d '{"state": "failure"}' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |