Deploy CI-built GHCR image to Fly.io after successful build
Assisted-by: Claude Opus 4.6 via Claude Code
change uqoorlzlwslyyyuyostlpyxomoowuvqo
commit 864ab48141bf4beb3656d2bbf17e46f56b16f1ba
author Alpha Chen <alpha@kejadlen.dev>
date
parent rtwrvuql
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ef3e8d5..14e86e8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,6 +23,8 @@ jobs:
   build:
     needs: test
     runs-on: ubuntu-latest
+    outputs:
+      image: ${{ steps.meta.outputs.tags }}
     steps:
       - uses: actions/checkout@v6
       - uses: ruby/setup-ruby@v1
@@ -64,3 +66,18 @@ jobs:
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: gh release upload "${{ steps.meta.outputs.version }}" snapshots.tar.gz
+
+  deploy:
+    name: Deploy to Fly.io
+    needs: build
+    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
+    runs-on: ubuntu-latest
+    concurrency:
+      group: fly-deploy
+      cancel-in-progress: true
+    steps:
+      - uses: actions/checkout@v6
+      - uses: superfly/flyctl-actions/setup-flyctl@master
+      - run: flyctl deploy --image ${{ needs.build.outputs.image }}
+        env:
+          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}