Skip to content

Commit 9f85c60

Browse files
authored
chore: update deploy pipeline (#5)
1 parent a55c900 commit 9f85c60

File tree

3 files changed

+33
-46
lines changed

3 files changed

+33
-46
lines changed

.github/workflows/deploy-fly.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
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 }}

examples/deployments/fly.io/deploy.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)