Skip to content

Deploy to Fly.io

Deploy to Fly.io #1

Workflow file for this run

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 }}