Tips and tricks
๐ Deploy to Fly.io Using GitHub Actions (With API Token)
Posted on February 25 2026 / in WordPress
This guide shows how to securely deploy your project to Fly.io using a GitHub Actions workflow and an API token.
1๏ธโฃ Generate Your Fly Deploy Token
Run this command locally:
fly tokens create deploy -x 999999h
This will generate a long-lived deploy token.
โ ๏ธ Copy the token immediately โ you will not be able to see it again.
2๏ธโฃ Add the Token to GitHub Secrets
Go to your GitHub repository:
Repository โ Settings โ Secrets and variables โ Actions
Then:
- Click New repository secret
- Name it:
FLY_API_TOKEN
- Paste the token generated in Step 1
- Click Add secret
Your token is now securely stored and encrypted inside GitHub.
3๏ธโฃ Update Your GitHub Workflow
Inside your repository, edit or create:
.github/workflows/deploy.yml
Make sure your workflow includes:
- name: Deploy to Fly
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
๐ What This Does
- Uses your stored GitHub secret
- Injects it into the environment at runtime
- Authenticates
flyctlsecurely - Deploys your app to Fly.io
No tokens stored in code. No hardcoded credentials.
โ Final Flow
GitHub Push
โ
GitHub Actions
โ
FLY_API_TOKEN (Secret)
โ
flyctl deploy --remote-only
โ
Fly.io Deployment
If
Deploying Your React Native App to iOS TestFlight
How to Host FE + BE on a Mac Mini with Caddy (Auto SSL)
Recent Comments
- admin on Disable Windows 11 Autoupdate
- Christina on Disable Windows 11 Autoupdate
- admin on Vimeo Thumbnail Generator
- Robert Moeck on Vimeo Thumbnail Generator
- Rainer on Vimeo Thumbnail Generator