Deploy to Fly.io #120
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 to Fly.io | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy-staging: | |
| if: github.event_name == 'push' | |
| name: Deploy to Fly.io (Staging) | |
| runs-on: ubuntu-latest | |
| environment: staging | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build Front-end | |
| run: cd frontend && yarn install && yarn build | |
| - name: Build API | |
| run: cd api && yarn install && yarn build | |
| - name: Install Fly.io CLI | |
| uses: superfly/flyctl-actions/setup-flyctl@v1 | |
| - name: Deploy to Fly.io (Staging) | |
| run: cd api && flyctl deploy -a codako-staging --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| deploy-prod: | |
| if: github.event_name == 'workflow_dispatch' | |
| name: Deploy to Fly.io (Production) | |
| runs-on: ubuntu-latest | |
| environment: prod | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build Front-end | |
| run: cd frontend && yarn install && yarn build | |
| - name: Build API | |
| run: cd api && yarn install && yarn build | |
| - name: Install Fly.io CLI | |
| uses: superfly/flyctl-actions/setup-flyctl@v1 | |
| - name: Deploy to Fly.io (Production) | |
| run: cd api && flyctl deploy -a codako-prod --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |