Deploy to Fly.io #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: Deploy to Fly.io | |
| on: | |
| workflow_run: | |
| workflows: ["CI"] | |
| types: | |
| - completed | |
| branches: ["main"] | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| deploy: | |
| name: Deploy to Fly.io | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: trunk | |
| # Only deploy if: | |
| # 1. CI workflow succeeded AND triggered by push to main (not from a PR) | |
| # 2. OR manually triggered (workflow_dispatch) | |
| # This prevents deployment from PRs even if someone modifies the workflow | |
| if: | | |
| (github.event.workflow_run.conclusion == 'success' && | |
| github.event.workflow_run.event == 'push' && | |
| github.event.workflow_run.head_branch == 'main') || | |
| github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Fly CLI | |
| uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy to Fly.io | |
| run: | | |
| cd examples/deployments/fly.io | |
| ./deploy.sh | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |