File tree Expand file tree Collapse file tree 3 files changed +33
-46
lines changed
examples/deployments/fly.io Expand file tree Collapse file tree 3 files changed +33
-46
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2222
2323 - name : Check formatting
2424 run : |
25- go fmt ./...
25+ make fmt
2626 if [ -n "$(git diff --name-only)" ]; then
2727 echo "Code is not properly formatted. Please run 'make fmt'"
2828 git diff
@@ -64,24 +64,43 @@ jobs:
6464 runs-on : ubuntu-latest
6565 needs : [quality-checks, test]
6666 # Only build and push Docker images on main branch after tests pass
67- # Note: Fly.io deployment happens in a separate workflow (deploy-fly.yaml)
6867 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
6968 steps :
7069 - uses : actions/checkout@v4
71-
70+
7271 - name : Set up Docker Buildx
7372 uses : docker/setup-buildx-action@v3
74-
73+
7574 - name : Log in to Docker Hub
7675 uses : docker/login-action@v3
7776 with :
7877 username : ${{ secrets.DOCKERHUB_USERNAME }}
7978 password : ${{ secrets.DOCKERHUB_TOKEN }}
80-
79+
8180 - name : Build info
8281 run : make docker-info
83-
82+
8483 - name : Build and push Docker image
8584 run : make docker-push
8685 env :
8786 DOCKER_PUSH : true
87+
88+ deploy :
89+ runs-on : ubuntu-latest
90+ needs : docker-build
91+ # Deploy to Fly.io after Docker image is built and pushed
92+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
93+ environment :
94+ name : trunk
95+ steps :
96+ - uses : actions/checkout@v4
97+
98+ - name : Setup Fly CLI
99+ uses : superfly/flyctl-actions/setup-flyctl@master
100+
101+ - name : Deploy to Fly.io
102+ run : |
103+ cd examples/deployments/fly.io
104+ ./deploy.sh
105+ env :
106+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
Original file line number Diff line number Diff line change @@ -70,14 +70,20 @@ main() {
7070 log_info " Deploying image: ${image_tag} "
7171
7272 # Deploy to Fly.io
73- if fly deploy --config fly.toml.generated; then
73+ # Use flyctl if available (GitHub Actions), otherwise fall back to fly
74+ FLY_CMD=" fly"
75+ if command -v flyctl > /dev/null 2>&1 ; then
76+ FLY_CMD=" flyctl"
77+ fi
78+
79+ if $FLY_CMD deploy --config fly.toml.generated; then
7480 log_info " ✓ Deployment successful!"
7581
7682 # Clean up generated file
7783 rm -f fly.toml.generated
7884
7985 # Show app info
80- fly status
86+ $FLY_CMD status
8187 else
8288 log_error " Deployment failed!"
8389 rm -f fly.toml.generated
You can’t perform that action at this time.
0 commit comments