π Deploy to Fly.io #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π Deploy to Fly.io | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: π οΈ Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π Read app name | |
uses: SebRollen/[email protected] | |
id: app_name | |
with: | |
file: 'fly.toml' | |
field: 'app' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: π Fly Registry Auth | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.fly.io | |
username: x | |
password: ${{ secrets.FLY_API_TOKEN }} | |
- name: π³ Docker build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: deploy | |
push: true | |
tags: | |
registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }} | |
cache-from: type=gha | |
cache-to: type=gha | |
provenance: false | |
deploy: | |
name: π Deploy | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π Read app name | |
uses: SebRollen/[email protected] | |
id: app_name | |
with: | |
file: 'fly.toml' | |
field: 'app' | |
- name: π Deploy Production | |
uses: superfly/[email protected] | |
with: | |
args: | |
'deploy --image registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}' | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |