@deftai/directive-content 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/deft/SKILL.md +6 -0
- package/.agents/skills/deft-directive-article-review/SKILL.md +11 -0
- package/.agents/skills/deft-directive-build/SKILL.md +10 -0
- package/.agents/skills/deft-directive-cost/SKILL.md +12 -0
- package/.agents/skills/deft-directive-debug/SKILL.md +13 -0
- package/.agents/skills/deft-directive-gh-arch/SKILL.md +11 -0
- package/.agents/skills/deft-directive-gh-slice/SKILL.md +10 -0
- package/.agents/skills/deft-directive-glossary/SKILL.md +10 -0
- package/.agents/skills/deft-directive-interview/SKILL.md +9 -0
- package/.agents/skills/deft-directive-pre-pr/SKILL.md +9 -0
- package/.agents/skills/deft-directive-refinement/SKILL.md +10 -0
- package/.agents/skills/deft-directive-release/SKILL.md +12 -0
- package/.agents/skills/deft-directive-review-cycle/SKILL.md +10 -0
- package/.agents/skills/deft-directive-setup/SKILL.md +10 -0
- package/.agents/skills/deft-directive-swarm/SKILL.md +10 -0
- package/.agents/skills/deft-directive-sync/SKILL.md +9 -0
- package/.agents/skills/deft-directive-triage/SKILL.md +9 -0
- package/.agents/skills/deft-directive-write-skill/SKILL.md +9 -0
- package/LICENSE.md +22 -0
- package/QUICK-START.md +167 -0
- package/UPGRADING.md +517 -0
- package/coding/build-output.md +28 -0
- package/coding/coding.md +235 -0
- package/coding/debugging.md +110 -0
- package/coding/holzmann.md +96 -0
- package/coding/hygiene.md +127 -0
- package/coding/security.md +158 -0
- package/coding/testing.md +162 -0
- package/coding/toolchain.md +44 -0
- package/commands.md +300 -0
- package/context/context.md +57 -0
- package/context/deterministic-split.md +67 -0
- package/context/examples.md +26 -0
- package/context/fractal-summaries.md +69 -0
- package/context/long-horizon.md +46 -0
- package/context/spec-deltas.md +177 -0
- package/context/tool-design.md +34 -0
- package/context/working-memory.md +62 -0
- package/contracts/boundary-maps.md +65 -0
- package/contracts/deterministic-questions.md +59 -0
- package/contracts/hierarchy.md +77 -0
- package/conventions/content-manifest.json +399 -0
- package/conventions/machine-generated-banner.md +130 -0
- package/conventions/references.md +120 -0
- package/conventions/rule-ownership.json +382 -0
- package/conventions/task-caching.md +43 -0
- package/conventions/vbrief-filenames.md +70 -0
- package/deployments/README.md +37 -0
- package/deployments/agentuity/README.md +138 -0
- package/deployments/agentuity/via-cli.md +380 -0
- package/deployments/agentuity/via-cloud.md +425 -0
- package/deployments/agentuity/via-github-actions.md +664 -0
- package/deployments/agentuity/via-gravity-network.md +606 -0
- package/deployments/agentuity/via-vpc.md +607 -0
- package/deployments/aws/README.md +38 -0
- package/deployments/aws/via-app-runner.md +612 -0
- package/deployments/aws/via-ecs-fargate.md +561 -0
- package/deployments/aws/via-elastic-beanstalk.md +628 -0
- package/deployments/aws/via-lambda.md +649 -0
- package/deployments/azure/README.md +37 -0
- package/deployments/azure/via-aks.md +390 -0
- package/deployments/azure/via-app-service.md +564 -0
- package/deployments/azure/via-container-apps.md +599 -0
- package/deployments/azure/via-functions.md +552 -0
- package/deployments/cloud-gov/README.md +63 -0
- package/deployments/cloud-gov/agents/compliance-docs.md +154 -0
- package/deployments/cloud-gov/agents.md +39 -0
- package/deployments/cloud-gov/cicd.md +64 -0
- package/deployments/cloud-gov/deployment.md +150 -0
- package/deployments/cloud-gov/logging.md +43 -0
- package/deployments/cloud-gov/manifest.md +121 -0
- package/deployments/cloud-gov/overview.md +58 -0
- package/deployments/cloud-gov/security.md +46 -0
- package/deployments/cloud-gov/services.md +72 -0
- package/deployments/cloud-gov/upstream/README.md +18 -0
- package/deployments/cloudflare/README.md +33 -0
- package/deployments/cloudflare/via-dashboard.md +83 -0
- package/deployments/cloudflare/via-git.md +90 -0
- package/deployments/cloudflare/via-github-actions.md +185 -0
- package/deployments/cloudflare/via-terraform.md +157 -0
- package/deployments/cloudflare/via-wrangler.md +165 -0
- package/deployments/fly-io/README.md +37 -0
- package/deployments/fly-io/via-dockerfile.md +648 -0
- package/deployments/fly-io/via-flyctl.md +653 -0
- package/deployments/fly-io/via-github-actions.md +695 -0
- package/deployments/fly-io/via-multi-region.md +598 -0
- package/deployments/google/README.md +34 -0
- package/deployments/google/via-app-engine.md +42 -0
- package/deployments/google/via-cloud-functions.md +23 -0
- package/deployments/google/via-cloud-run.md +330 -0
- package/deployments/google/via-gke.md +23 -0
- package/deployments/netlify/README.md +99 -0
- package/deployments/netlify/via-cli.md +17 -0
- package/deployments/netlify/via-functions.md +19 -0
- package/deployments/netlify/via-git.md +25 -0
- package/deployments/vercel/README.md +90 -0
- package/deployments/vercel/via-api.md +16 -0
- package/deployments/vercel/via-cli.md +17 -0
- package/deployments/vercel/via-git.md +24 -0
- package/docs/BROWNFIELD.md +179 -0
- package/docs/getting-started.md +137 -0
- package/docs/good-agents-md.md +137 -0
- package/events/README.md +89 -0
- package/events/event-record.schema.json +26 -0
- package/events/registry.json +166 -0
- package/events/registry.schema.json +71 -0
- package/glossary.md +145 -0
- package/incidents/README.md +81 -0
- package/incidents/_template.md +38 -0
- package/interfaces/cli.md +104 -0
- package/interfaces/rest.md +212 -0
- package/interfaces/tui.md +242 -0
- package/interfaces/web.md +123 -0
- package/languages/6502-DASM.md +132 -0
- package/languages/c.md +235 -0
- package/languages/commands.md +23 -0
- package/languages/cpp.md +132 -0
- package/languages/csharp.md +259 -0
- package/languages/dart.md +183 -0
- package/languages/delphi.md +218 -0
- package/languages/elixir.md +208 -0
- package/languages/go.md +78 -0
- package/languages/java.md +278 -0
- package/languages/javascript.md +163 -0
- package/languages/julia.md +175 -0
- package/languages/kotlin.md +193 -0
- package/languages/markdown.md +168 -0
- package/languages/mermaid.md +146 -0
- package/languages/officejs.md +392 -0
- package/languages/python.md +209 -0
- package/languages/r.md +163 -0
- package/languages/rust.md +216 -0
- package/languages/sql.md +216 -0
- package/languages/swift.md +153 -0
- package/languages/typescript.md +132 -0
- package/languages/vba.md +279 -0
- package/languages/vhdl.md +180 -0
- package/languages/visual-basic.md +151 -0
- package/languages/zig.md +196 -0
- package/meta/SOUL.md +27 -0
- package/meta/code-field.md +44 -0
- package/meta/morals.md +40 -0
- package/meta/philosophy.md +39 -0
- package/meta/project.md +49 -0
- package/meta/ralph.md +223 -0
- package/meta/security.md +80 -0
- package/meta/versioning.md +326 -0
- package/package.json +22 -0
- package/packs/lessons/lessons-pack-0.1.json +553 -0
- package/packs/patterns/patterns-pack-0.1.json +57 -0
- package/packs/rules/rules-pack-0.1.json +4767 -0
- package/packs/skills/skills-pack-0.1.json +262 -0
- package/packs/strategies/strategies-pack-0.1.json +167 -0
- package/packs/swarm-spec/swarm-spec-pack-0.1.json +17 -0
- package/patterns/executor-layer-credentials.md +227 -0
- package/patterns/llm-app.md +156 -0
- package/patterns/multi-agent.md +278 -0
- package/patterns/prompt-assembly-layer-ordering.md +154 -0
- package/patterns/role-as-overlay.md +179 -0
- package/platforms/2600.md +137 -0
- package/platforms/unity.md +329 -0
- package/references/composer-skill-porting.md +152 -0
- package/references/cost-models.md +163 -0
- package/references/ip-risk.md +246 -0
- package/references/plain-english-ux.md +275 -0
- package/resilience/context-pruning.md +67 -0
- package/resilience/continue-here.md +62 -0
- package/scm/changelog.md +276 -0
- package/scm/git.md +139 -0
- package/scm/github.md +265 -0
- package/secrets/.gitkeep +0 -0
- package/skills/deft-build/SKILL.md +20 -0
- package/skills/deft-directive-article-review/SKILL.md +156 -0
- package/skills/deft-directive-build/SKILL.md +302 -0
- package/skills/deft-directive-cost/SKILL.md +201 -0
- package/skills/deft-directive-debug/SKILL.md +140 -0
- package/skills/deft-directive-decompose/SKILL.md +96 -0
- package/skills/deft-directive-gh-arch/SKILL.md +160 -0
- package/skills/deft-directive-gh-slice/SKILL.md +199 -0
- package/skills/deft-directive-glossary/SKILL.md +118 -0
- package/skills/deft-directive-interview/SKILL.md +528 -0
- package/skills/deft-directive-pre-pr/SKILL.md +131 -0
- package/skills/deft-directive-probe/SKILL.md +127 -0
- package/skills/deft-directive-refinement/SKILL.md +403 -0
- package/skills/deft-directive-release/SKILL.md +266 -0
- package/skills/deft-directive-review-cycle/SKILL.md +401 -0
- package/skills/deft-directive-setup/SKILL.md +717 -0
- package/skills/deft-directive-swarm/SKILL.md +989 -0
- package/skills/deft-directive-sync/SKILL.md +288 -0
- package/skills/deft-directive-triage/SKILL.md +137 -0
- package/skills/deft-directive-write-skill/SKILL.md +169 -0
- package/skills/deft-interview/SKILL.md +16 -0
- package/skills/deft-pre-pr/SKILL.md +16 -0
- package/skills/deft-review-cycle/SKILL.md +16 -0
- package/skills/deft-roadmap-refresh/SKILL.md +16 -0
- package/skills/deft-setup/SKILL.md +20 -0
- package/skills/deft-swarm/SKILL.md +16 -0
- package/skills/deft-sync/SKILL.md +16 -0
- package/strategies/README.md +83 -0
- package/strategies/artifact-guards.md +85 -0
- package/strategies/bdd.md +115 -0
- package/strategies/brownfield.md +7 -0
- package/strategies/discuss.md +129 -0
- package/strategies/emit-hints.md +69 -0
- package/strategies/enterprise.md +193 -0
- package/strategies/interview.md +551 -0
- package/strategies/map.md +179 -0
- package/strategies/probe.md +151 -0
- package/strategies/rapid.md +155 -0
- package/strategies/research.md +155 -0
- package/strategies/roadmap.md +9 -0
- package/strategies/speckit.md +437 -0
- package/strategies/v0-20-contract.md +134 -0
- package/strategies/yolo.md +169 -0
- package/swarm/swarm.md +300 -0
- package/templates/COST-ESTIMATE.md +114 -0
- package/templates/PULL_REQUEST_TEMPLATE.md +35 -0
- package/templates/agent-prompt-preamble.md +409 -0
- package/templates/agents-entry.md +211 -0
- package/templates/agents-entry.placeholders.md +75 -0
- package/templates/embed.go +20 -0
- package/templates/embed_test.go +36 -0
- package/templates/make-spec-example.md +9 -0
- package/templates/make-spec.md +246 -0
- package/templates/project.md.template +52 -0
- package/templates/specification.md +1 -0
- package/templates/swarm-greptile-poller-prompt.md +556 -0
- package/templates/user.md.template +31 -0
- package/tools/RWLDL.md +80 -0
- package/tools/greptile.md +141 -0
- package/tools/installer.md +23 -0
- package/tools/taskfile-migration.md +32 -0
- package/tools/taskfile.md +185 -0
- package/tools/telemetry.md +285 -0
- package/vbrief/schemas/cache-meta.schema.json +137 -0
- package/vbrief/schemas/candidates.schema.json +130 -0
- package/vbrief/schemas/codebase-map.schema.json +213 -0
- package/vbrief/schemas/lessons-pack.schema.json +134 -0
- package/vbrief/schemas/patterns-pack.schema.json +84 -0
- package/vbrief/schemas/rules-pack.schema.json +105 -0
- package/vbrief/schemas/skills-pack.schema.json +94 -0
- package/vbrief/schemas/slices.schema.json +87 -0
- package/vbrief/schemas/strategies-pack.schema.json +89 -0
- package/vbrief/schemas/swarm-spec-pack.schema.json +84 -0
- package/vbrief/schemas/vbrief-core.schema.json +1022 -0
- package/vbrief/vbrief.md +684 -0
- package/verification/integration.md +76 -0
- package/verification/plan-checking.md +85 -0
- package/verification/uat.md +60 -0
- package/verification/verification.md +117 -0
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
# Deploy via GitHub Actions
|
|
2
|
+
|
|
3
|
+
Automate Fly.io deployments using GitHub Actions for continuous integration and delivery. Deploy on every push with automated testing, secrets management, and multi-environment support.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Fly.io provides official GitHub Actions for seamless CI/CD:
|
|
8
|
+
- **Automatic Deployments**: Deploy on push to main
|
|
9
|
+
- **PR Preview Apps**: Deploy preview environments for pull requests
|
|
10
|
+
- **Multi-Environment**: Separate staging and production
|
|
11
|
+
- **Secrets Management**: Secure FLY_API_TOKEN handling
|
|
12
|
+
- **Matrix Deployments**: Deploy multiple apps in parallel
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- GitHub repository with your application code
|
|
17
|
+
- Fly.io account
|
|
18
|
+
- Fly.io API token
|
|
19
|
+
|
|
20
|
+
## Quick Setup
|
|
21
|
+
|
|
22
|
+
### 1. Generate Fly.io API Token
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Generate deploy token
|
|
26
|
+
fly auth token
|
|
27
|
+
|
|
28
|
+
# Copy the token for GitHub secrets
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Add GitHub Secrets
|
|
32
|
+
|
|
33
|
+
Go to repository → Settings → Secrets and variables → Actions
|
|
34
|
+
|
|
35
|
+
Add:
|
|
36
|
+
- `FLY_API_TOKEN` - Your Fly.io API token
|
|
37
|
+
|
|
38
|
+
### 3. Create Workflow File
|
|
39
|
+
|
|
40
|
+
Create `.github/workflows/fly.yml`:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
name: Deploy to Fly.io
|
|
44
|
+
|
|
45
|
+
on:
|
|
46
|
+
push:
|
|
47
|
+
branches:
|
|
48
|
+
- main
|
|
49
|
+
|
|
50
|
+
jobs:
|
|
51
|
+
deploy:
|
|
52
|
+
name: Deploy app
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
58
|
+
|
|
59
|
+
- run: flyctl deploy --remote-only
|
|
60
|
+
env:
|
|
61
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Official Fly.io Actions
|
|
65
|
+
|
|
66
|
+
### Setup flyctl Action
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
70
|
+
with:
|
|
71
|
+
version: latest # or specific version like 0.0.500
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Deploy Action
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
- uses: superfly/flyctl-actions@master
|
|
78
|
+
with:
|
|
79
|
+
args: "deploy --remote-only"
|
|
80
|
+
env:
|
|
81
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Workflow Examples
|
|
85
|
+
|
|
86
|
+
### Basic Production Deployment
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
name: Fly Deploy
|
|
90
|
+
|
|
91
|
+
on:
|
|
92
|
+
push:
|
|
93
|
+
branches:
|
|
94
|
+
- main
|
|
95
|
+
|
|
96
|
+
jobs:
|
|
97
|
+
deploy:
|
|
98
|
+
name: Deploy to production
|
|
99
|
+
runs-on: ubuntu-latest
|
|
100
|
+
steps:
|
|
101
|
+
- uses: actions/checkout@v4
|
|
102
|
+
|
|
103
|
+
- name: Setup flyctl
|
|
104
|
+
uses: superfly/flyctl-actions/setup-flyctl@master
|
|
105
|
+
|
|
106
|
+
- name: Deploy to Fly
|
|
107
|
+
run: flyctl deploy --remote-only
|
|
108
|
+
env:
|
|
109
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Deploy with Tests
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
name: Test and Deploy
|
|
116
|
+
|
|
117
|
+
on:
|
|
118
|
+
push:
|
|
119
|
+
branches: [main]
|
|
120
|
+
|
|
121
|
+
jobs:
|
|
122
|
+
test:
|
|
123
|
+
runs-on: ubuntu-latest
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
|
|
127
|
+
- uses: actions/setup-node@v4
|
|
128
|
+
with:
|
|
129
|
+
node-version: '18'
|
|
130
|
+
cache: 'npm'
|
|
131
|
+
|
|
132
|
+
- run: npm ci
|
|
133
|
+
- run: npm test
|
|
134
|
+
- run: npm run lint
|
|
135
|
+
|
|
136
|
+
deploy:
|
|
137
|
+
needs: test
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
steps:
|
|
140
|
+
- uses: actions/checkout@v4
|
|
141
|
+
|
|
142
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
143
|
+
|
|
144
|
+
- run: flyctl deploy --remote-only
|
|
145
|
+
env:
|
|
146
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Multi-Environment Deployment
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
name: Deploy Pipeline
|
|
153
|
+
|
|
154
|
+
on:
|
|
155
|
+
push:
|
|
156
|
+
branches:
|
|
157
|
+
- main
|
|
158
|
+
- staging
|
|
159
|
+
|
|
160
|
+
jobs:
|
|
161
|
+
deploy-staging:
|
|
162
|
+
if: github.ref == 'refs/heads/staging'
|
|
163
|
+
runs-on: ubuntu-latest
|
|
164
|
+
steps:
|
|
165
|
+
- uses: actions/checkout@v4
|
|
166
|
+
|
|
167
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
168
|
+
|
|
169
|
+
- run: flyctl deploy --app my-app-staging --remote-only
|
|
170
|
+
env:
|
|
171
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
172
|
+
|
|
173
|
+
deploy-production:
|
|
174
|
+
if: github.ref == 'refs/heads/main'
|
|
175
|
+
runs-on: ubuntu-latest
|
|
176
|
+
environment: production
|
|
177
|
+
steps:
|
|
178
|
+
- uses: actions/checkout@v4
|
|
179
|
+
|
|
180
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
181
|
+
|
|
182
|
+
- run: flyctl deploy --app my-app-production --remote-only
|
|
183
|
+
env:
|
|
184
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### PR Preview Deployments
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
name: PR Preview
|
|
191
|
+
|
|
192
|
+
on:
|
|
193
|
+
pull_request:
|
|
194
|
+
types: [opened, synchronize, reopened, closed]
|
|
195
|
+
|
|
196
|
+
jobs:
|
|
197
|
+
preview:
|
|
198
|
+
runs-on: ubuntu-latest
|
|
199
|
+
|
|
200
|
+
# Don't run on closed PRs unless we're cleaning up
|
|
201
|
+
if: github.event.action != 'closed' || github.event.pull_request.merged == true
|
|
202
|
+
|
|
203
|
+
steps:
|
|
204
|
+
- uses: actions/checkout@v4
|
|
205
|
+
|
|
206
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
207
|
+
|
|
208
|
+
- name: Deploy PR Preview
|
|
209
|
+
if: github.event.action != 'closed'
|
|
210
|
+
run: |
|
|
211
|
+
PR_NUMBER=${{ github.event.pull_request.number }}
|
|
212
|
+
flyctl deploy \
|
|
213
|
+
--app my-app-pr-$PR_NUMBER \
|
|
214
|
+
--remote-only \
|
|
215
|
+
--auto-confirm
|
|
216
|
+
env:
|
|
217
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
218
|
+
|
|
219
|
+
- name: Comment PR with URL
|
|
220
|
+
if: github.event.action != 'closed'
|
|
221
|
+
uses: actions/github-script@v7
|
|
222
|
+
with:
|
|
223
|
+
script: |
|
|
224
|
+
const pr = ${{ github.event.pull_request.number }};
|
|
225
|
+
github.rest.issues.createComment({
|
|
226
|
+
issue_number: pr,
|
|
227
|
+
owner: context.repo.owner,
|
|
228
|
+
repo: context.repo.repo,
|
|
229
|
+
body: `🚀 Preview deployed: https://my-app-pr-${pr}.fly.dev`
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
- name: Destroy PR Preview
|
|
233
|
+
if: github.event.action == 'closed'
|
|
234
|
+
run: |
|
|
235
|
+
PR_NUMBER=${{ github.event.pull_request.number }}
|
|
236
|
+
flyctl apps destroy my-app-pr-$PR_NUMBER --yes || true
|
|
237
|
+
env:
|
|
238
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Matrix Deploy (Multiple Apps)
|
|
242
|
+
|
|
243
|
+
```yaml
|
|
244
|
+
name: Deploy All Apps
|
|
245
|
+
|
|
246
|
+
on:
|
|
247
|
+
push:
|
|
248
|
+
branches: [main]
|
|
249
|
+
|
|
250
|
+
jobs:
|
|
251
|
+
deploy:
|
|
252
|
+
runs-on: ubuntu-latest
|
|
253
|
+
strategy:
|
|
254
|
+
matrix:
|
|
255
|
+
app:
|
|
256
|
+
- name: api
|
|
257
|
+
path: ./apps/api
|
|
258
|
+
- name: web
|
|
259
|
+
path: ./apps/web
|
|
260
|
+
- name: worker
|
|
261
|
+
path: ./apps/worker
|
|
262
|
+
|
|
263
|
+
steps:
|
|
264
|
+
- uses: actions/checkout@v4
|
|
265
|
+
|
|
266
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
267
|
+
|
|
268
|
+
- name: Deploy ${{ matrix.app.name }}
|
|
269
|
+
run: flyctl deploy --config ${{ matrix.app.path }}/fly.toml --remote-only
|
|
270
|
+
env:
|
|
271
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Deploy with Docker Build
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
name: Docker Build and Deploy
|
|
278
|
+
|
|
279
|
+
on:
|
|
280
|
+
push:
|
|
281
|
+
branches: [main]
|
|
282
|
+
|
|
283
|
+
jobs:
|
|
284
|
+
deploy:
|
|
285
|
+
runs-on: ubuntu-latest
|
|
286
|
+
steps:
|
|
287
|
+
- uses: actions/checkout@v4
|
|
288
|
+
|
|
289
|
+
- name: Set up Docker Buildx
|
|
290
|
+
uses: docker/setup-buildx-action@v3
|
|
291
|
+
|
|
292
|
+
- name: Build and push to Fly registry
|
|
293
|
+
uses: docker/build-push-action@v5
|
|
294
|
+
with:
|
|
295
|
+
context: .
|
|
296
|
+
push: true
|
|
297
|
+
tags: registry.fly.io/my-app:${{ github.sha }}
|
|
298
|
+
cache-from: type=gha
|
|
299
|
+
cache-to: type=gha,mode=max
|
|
300
|
+
|
|
301
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
302
|
+
|
|
303
|
+
- name: Deploy to Fly
|
|
304
|
+
run: flyctl deploy --image registry.fly.io/my-app:${{ github.sha }}
|
|
305
|
+
env:
|
|
306
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Advanced Configurations
|
|
310
|
+
|
|
311
|
+
### Database Migrations
|
|
312
|
+
|
|
313
|
+
```yaml
|
|
314
|
+
name: Deploy with Migrations
|
|
315
|
+
|
|
316
|
+
on:
|
|
317
|
+
push:
|
|
318
|
+
branches: [main]
|
|
319
|
+
|
|
320
|
+
jobs:
|
|
321
|
+
deploy:
|
|
322
|
+
runs-on: ubuntu-latest
|
|
323
|
+
steps:
|
|
324
|
+
- uses: actions/checkout@v4
|
|
325
|
+
|
|
326
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
327
|
+
|
|
328
|
+
- name: Run database migrations
|
|
329
|
+
run: |
|
|
330
|
+
flyctl ssh console -C "npm run migrate"
|
|
331
|
+
env:
|
|
332
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
333
|
+
|
|
334
|
+
- name: Deploy application
|
|
335
|
+
run: flyctl deploy --remote-only
|
|
336
|
+
env:
|
|
337
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Canary Deployment
|
|
341
|
+
|
|
342
|
+
```yaml
|
|
343
|
+
name: Canary Deploy
|
|
344
|
+
|
|
345
|
+
on:
|
|
346
|
+
push:
|
|
347
|
+
branches: [main]
|
|
348
|
+
|
|
349
|
+
jobs:
|
|
350
|
+
canary:
|
|
351
|
+
runs-on: ubuntu-latest
|
|
352
|
+
steps:
|
|
353
|
+
- uses: actions/checkout@v4
|
|
354
|
+
|
|
355
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
356
|
+
|
|
357
|
+
- name: Deploy canary
|
|
358
|
+
run: flyctl deploy --strategy canary --remote-only
|
|
359
|
+
env:
|
|
360
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
361
|
+
|
|
362
|
+
- name: Wait and monitor
|
|
363
|
+
run: sleep 300 # Wait 5 minutes
|
|
364
|
+
|
|
365
|
+
- name: Check health metrics
|
|
366
|
+
run: |
|
|
367
|
+
STATUS=$(flyctl status --json | jq -r '.health_checks[0].status')
|
|
368
|
+
if [ "$STATUS" != "passing" ]; then
|
|
369
|
+
echo "Health checks failing, rolling back"
|
|
370
|
+
flyctl releases rollback
|
|
371
|
+
exit 1
|
|
372
|
+
fi
|
|
373
|
+
env:
|
|
374
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Multi-Region Deployment
|
|
378
|
+
|
|
379
|
+
```yaml
|
|
380
|
+
name: Multi-Region Deploy
|
|
381
|
+
|
|
382
|
+
on:
|
|
383
|
+
push:
|
|
384
|
+
branches: [main]
|
|
385
|
+
|
|
386
|
+
jobs:
|
|
387
|
+
deploy:
|
|
388
|
+
runs-on: ubuntu-latest
|
|
389
|
+
steps:
|
|
390
|
+
- uses: actions/checkout@v4
|
|
391
|
+
|
|
392
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
393
|
+
|
|
394
|
+
- name: Deploy to multiple regions
|
|
395
|
+
run: |
|
|
396
|
+
flyctl deploy --remote-only
|
|
397
|
+
flyctl regions add iad lhr syd
|
|
398
|
+
flyctl scale count 3
|
|
399
|
+
env:
|
|
400
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Deploy with Secrets
|
|
404
|
+
|
|
405
|
+
```yaml
|
|
406
|
+
name: Deploy with Runtime Secrets
|
|
407
|
+
|
|
408
|
+
on:
|
|
409
|
+
push:
|
|
410
|
+
branches: [main]
|
|
411
|
+
|
|
412
|
+
jobs:
|
|
413
|
+
deploy:
|
|
414
|
+
runs-on: ubuntu-latest
|
|
415
|
+
steps:
|
|
416
|
+
- uses: actions/checkout@v4
|
|
417
|
+
|
|
418
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
419
|
+
|
|
420
|
+
- name: Set secrets
|
|
421
|
+
run: |
|
|
422
|
+
echo "${{ secrets.ENV_FILE }}" | flyctl secrets import
|
|
423
|
+
env:
|
|
424
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
425
|
+
|
|
426
|
+
- name: Deploy
|
|
427
|
+
run: flyctl deploy --remote-only
|
|
428
|
+
env:
|
|
429
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Deployment Strategies
|
|
433
|
+
|
|
434
|
+
### Blue-Green Deployment
|
|
435
|
+
|
|
436
|
+
```yaml
|
|
437
|
+
- name: Blue-Green Deploy
|
|
438
|
+
run: flyctl deploy --strategy bluegreen --remote-only
|
|
439
|
+
env:
|
|
440
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Rolling Deployment
|
|
444
|
+
|
|
445
|
+
```yaml
|
|
446
|
+
# Configure in fly.toml
|
|
447
|
+
[deploy]
|
|
448
|
+
strategy = "rolling"
|
|
449
|
+
max_unavailable = 1
|
|
450
|
+
|
|
451
|
+
# Then deploy normally
|
|
452
|
+
- run: flyctl deploy --remote-only
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Immediate Deployment
|
|
456
|
+
|
|
457
|
+
```yaml
|
|
458
|
+
# Deploy without waiting for health checks
|
|
459
|
+
- run: flyctl deploy --remote-only --now
|
|
460
|
+
env:
|
|
461
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Monitoring & Notifications
|
|
465
|
+
|
|
466
|
+
### Slack Notifications
|
|
467
|
+
|
|
468
|
+
```yaml
|
|
469
|
+
name: Deploy with Notifications
|
|
470
|
+
|
|
471
|
+
on:
|
|
472
|
+
push:
|
|
473
|
+
branches: [main]
|
|
474
|
+
|
|
475
|
+
jobs:
|
|
476
|
+
deploy:
|
|
477
|
+
runs-on: ubuntu-latest
|
|
478
|
+
steps:
|
|
479
|
+
- uses: actions/checkout@v4
|
|
480
|
+
|
|
481
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
482
|
+
|
|
483
|
+
- name: Deploy
|
|
484
|
+
id: deploy
|
|
485
|
+
run: flyctl deploy --remote-only
|
|
486
|
+
env:
|
|
487
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
488
|
+
|
|
489
|
+
- name: Notify Slack on success
|
|
490
|
+
if: success()
|
|
491
|
+
uses: slackapi/slack-github-action@v1
|
|
492
|
+
with:
|
|
493
|
+
payload: |
|
|
494
|
+
{
|
|
495
|
+
"text": "✅ Deployed to Fly.io successfully",
|
|
496
|
+
"blocks": [
|
|
497
|
+
{
|
|
498
|
+
"type": "section",
|
|
499
|
+
"text": {
|
|
500
|
+
"type": "mrkdwn",
|
|
501
|
+
"text": "✅ *Deployment Successful*\nCommit: ${{ github.sha }}\nAuthor: ${{ github.actor }}"
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
env:
|
|
507
|
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
|
|
508
|
+
|
|
509
|
+
- name: Notify Slack on failure
|
|
510
|
+
if: failure()
|
|
511
|
+
uses: slackapi/slack-github-action@v1
|
|
512
|
+
with:
|
|
513
|
+
payload: |
|
|
514
|
+
{
|
|
515
|
+
"text": "❌ Fly.io deployment failed"
|
|
516
|
+
}
|
|
517
|
+
env:
|
|
518
|
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Post-Deployment Health Check
|
|
522
|
+
|
|
523
|
+
```yaml
|
|
524
|
+
- name: Health Check
|
|
525
|
+
run: |
|
|
526
|
+
sleep 30
|
|
527
|
+
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://my-app.fly.dev/health)
|
|
528
|
+
if [ $STATUS_CODE -ne 200 ]; then
|
|
529
|
+
echo "Health check failed with status $STATUS_CODE"
|
|
530
|
+
flyctl releases rollback
|
|
531
|
+
exit 1
|
|
532
|
+
fi
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
## Best Practices
|
|
536
|
+
|
|
537
|
+
### 1. Use GitHub Environments
|
|
538
|
+
|
|
539
|
+
```yaml
|
|
540
|
+
jobs:
|
|
541
|
+
deploy:
|
|
542
|
+
runs-on: ubuntu-latest
|
|
543
|
+
environment: production # Requires manual approval
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### 2. Pin flyctl Version
|
|
547
|
+
|
|
548
|
+
```yaml
|
|
549
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
550
|
+
with:
|
|
551
|
+
version: 0.0.500 # Pin to specific version
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### 3. Secure Secrets
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
# Use GitHub environment secrets for sensitive data
|
|
558
|
+
# Never commit FLY_API_TOKEN to repository
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### 4. Deploy on Merge Only
|
|
562
|
+
|
|
563
|
+
```yaml
|
|
564
|
+
on:
|
|
565
|
+
pull_request:
|
|
566
|
+
types: [closed]
|
|
567
|
+
branches: [main]
|
|
568
|
+
|
|
569
|
+
jobs:
|
|
570
|
+
deploy:
|
|
571
|
+
if: github.event.pull_request.merged == true
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### 5. Use Build Cache
|
|
575
|
+
|
|
576
|
+
```yaml
|
|
577
|
+
- uses: docker/build-push-action@v5
|
|
578
|
+
with:
|
|
579
|
+
cache-from: type=gha
|
|
580
|
+
cache-to: type=gha,mode=max
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
## Troubleshooting
|
|
584
|
+
|
|
585
|
+
### Deployment Timeout
|
|
586
|
+
|
|
587
|
+
```yaml
|
|
588
|
+
- name: Deploy with longer timeout
|
|
589
|
+
run: flyctl deploy --remote-only --wait-timeout 900
|
|
590
|
+
env:
|
|
591
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Debug Mode
|
|
595
|
+
|
|
596
|
+
```yaml
|
|
597
|
+
- name: Deploy with verbose logging
|
|
598
|
+
run: flyctl deploy --remote-only --verbose
|
|
599
|
+
env:
|
|
600
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
601
|
+
FLY_LOG_LEVEL: debug
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### Authentication Issues
|
|
605
|
+
|
|
606
|
+
```yaml
|
|
607
|
+
- name: Verify authentication
|
|
608
|
+
run: flyctl auth whoami
|
|
609
|
+
env:
|
|
610
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## Complete Example
|
|
614
|
+
|
|
615
|
+
```yaml
|
|
616
|
+
name: Complete CI/CD Pipeline
|
|
617
|
+
|
|
618
|
+
on:
|
|
619
|
+
push:
|
|
620
|
+
branches: [main]
|
|
621
|
+
pull_request:
|
|
622
|
+
types: [opened, synchronize]
|
|
623
|
+
|
|
624
|
+
env:
|
|
625
|
+
FLY_APP_NAME: my-app
|
|
626
|
+
|
|
627
|
+
jobs:
|
|
628
|
+
test:
|
|
629
|
+
runs-on: ubuntu-latest
|
|
630
|
+
steps:
|
|
631
|
+
- uses: actions/checkout@v4
|
|
632
|
+
|
|
633
|
+
- uses: actions/setup-node@v4
|
|
634
|
+
with:
|
|
635
|
+
node-version: '18'
|
|
636
|
+
cache: 'npm'
|
|
637
|
+
|
|
638
|
+
- run: npm ci
|
|
639
|
+
- run: npm run lint
|
|
640
|
+
- run: npm test
|
|
641
|
+
- run: npm run build
|
|
642
|
+
|
|
643
|
+
deploy-preview:
|
|
644
|
+
if: github.event_name == 'pull_request'
|
|
645
|
+
needs: test
|
|
646
|
+
runs-on: ubuntu-latest
|
|
647
|
+
steps:
|
|
648
|
+
- uses: actions/checkout@v4
|
|
649
|
+
|
|
650
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
651
|
+
|
|
652
|
+
- name: Deploy PR preview
|
|
653
|
+
run: |
|
|
654
|
+
PR_NUMBER=${{ github.event.pull_request.number }}
|
|
655
|
+
flyctl deploy \
|
|
656
|
+
--app ${{ env.FLY_APP_NAME }}-pr-$PR_NUMBER \
|
|
657
|
+
--remote-only
|
|
658
|
+
env:
|
|
659
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
660
|
+
|
|
661
|
+
deploy-production:
|
|
662
|
+
if: github.ref == 'refs/heads/main'
|
|
663
|
+
needs: test
|
|
664
|
+
runs-on: ubuntu-latest
|
|
665
|
+
environment: production
|
|
666
|
+
steps:
|
|
667
|
+
- uses: actions/checkout@v4
|
|
668
|
+
|
|
669
|
+
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
670
|
+
|
|
671
|
+
- name: Deploy to production
|
|
672
|
+
run: flyctl deploy --remote-only
|
|
673
|
+
env:
|
|
674
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
675
|
+
|
|
676
|
+
- name: Health check
|
|
677
|
+
run: |
|
|
678
|
+
sleep 30
|
|
679
|
+
curl -f https://${{ env.FLY_APP_NAME }}.fly.dev/health || (
|
|
680
|
+
flyctl releases rollback && exit 1
|
|
681
|
+
)
|
|
682
|
+
env:
|
|
683
|
+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
684
|
+
|
|
685
|
+
- name: Notify team
|
|
686
|
+
if: success()
|
|
687
|
+
run: echo "Deployed successfully to production"
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
## References
|
|
691
|
+
|
|
692
|
+
- [Fly.io GitHub Actions](https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/)
|
|
693
|
+
- [flyctl-actions Repository](https://github.com/superfly/flyctl-actions)
|
|
694
|
+
- [GitHub Actions Documentation](https://docs.github.com/actions)
|
|
695
|
+
- [Deployment Strategies](https://fly.io/docs/reference/deployment/)
|