# Copyright 2026 Google LLC
# SPDX-License-Identifier: Apache-2.0
#
# Deploy to Fly.io.
#
# STATUS: DISABLED (manual trigger only).
#
# Prerequisites:
# 1. Install flyctl and create a Fly.io account.
# 2. Create a deploy token: flyctl tokens create deploy
# 3. Set these repository secrets:
# - FLY_API_TOKEN — Fly.io deploy token
# - GEMINI_API_KEY — Gemini API key for the deployed service
name: Deploy to Fly.io
on:
workflow_dispatch:
inputs:
app_name:
description: 'Fly.io app name'
required: true
default: 'genkit-endpoints'
region:
description: 'Fly.io region (iad, lhr, nrt, syd, etc.)'
required: true
default: 'iad'
defaults:
run:
working-directory: py/samples/web-endpoints-hello
jobs:
deploy:
name: Build & Deploy
runs-on: ubuntu-latest
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Generate fly.toml
env:
APP_NAME: ${{ inputs.app_name }}
REGION: ${{ inputs.region }}
run: |
cat > fly.toml << EOF
app = "${APP_NAME}"
primary_region = "${REGION}"
[build]
dockerfile = "Containerfile"
[env]
PORT = "8080"
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 0
[[http_service.checks]]
grace_period = "10s"
interval = "30s"
method = "GET"
path = "/health"
timeout = "5s"
[[vm]]
memory = "512mb"
cpu_kind = "shared"
cpus = 1
EOF
- name: Create app (if needed)
env:
APP_NAME: ${{ inputs.app_name }}
continue-on-error: true
run: flyctl apps create "$APP_NAME" --machines
- name: Set secrets
env:
APP_NAME: ${{ inputs.app_name }}
run: |
flyctl secrets set \
"GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}" \
--app "$APP_NAME"
- name: Deploy
env:
APP_NAME: ${{ inputs.app_name }}
REGION: ${{ inputs.region }}
run: flyctl deploy --app "$APP_NAME" --region "$REGION"
- name: Show service URL
env:
APP_NAME: ${{ inputs.app_name }}
run: |
echo "Service URL: https://${APP_NAME}.fly.dev"
echo "Test: curl https://${APP_NAME}.fly.dev/health"
echo "Dashboard: https://fly.io/apps/${APP_NAME}"