Skip to content

🚀 Deploy

🚀 Deploy #235

Workflow file for this run

# @copyright https://raw.githubusercontent.com/rphlmr/supa-fly-stack/main/.github/workflows/deploy.yml
name: 🚀 Deploy
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
actions: write
contents: read
jobs:
build:
name: 🐳 Build
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
steps:
- name: ⬇️ Checkout repo
uses: actions/[email protected]
- name: 👀 Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: "fly.toml"
field: "app"
- name: 🐳 Set up Docker Buildx
uses: docker/[email protected]
# Setup cache
- name: ⚡️ Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: 🔑 Fly Registry Auth
uses: docker/[email protected]
with:
registry: registry.fly.io
username: x
password: ${{ secrets.FLY_API_TOKEN }}
- name: 🐳 Docker build
uses: docker/[email protected]
with:
context: .
push: true
tags: registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.ref_name }}-${{ github.sha }}
build-args: |
COMMIT_SHA=${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
# This ugly bit is necessary if you don't want your cache to grow forever
# till it hits GitHub's limit of 5GB.
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: 🚚 Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
deploy:
name: 🚀 Deploy
runs-on: ubuntu-latest
needs: [build]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
steps:
- name: ⬇️ Checkout repo
uses: actions/[email protected]
- 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 }}-${{ github.sha }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}