-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (73 loc) · 2.27 KB
/
deploy-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Production Deploy
on:
push:
branches:
- main
tags:
- "v*.*.*"
workflow_dispatch:
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
permissions:
packages: write
jobs:
build:
name: Build application
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
- name: Setup Fly.io command line tool
id: setup-flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Generate Docker metadata
id: docker-image-metadata
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
registry.fly.io/headless-three-prod
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Fly.io Container Registry
run: flyctl auth docker
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker-image-metadata.outputs.tags }}
labels: ${{ steps.docker-image-metadata.outputs.labels }}
deploy:
name: Deploy app
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v2
- name: Setup
id: setup
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Build and Deploy
id: build-and-deploy
run: flyctl deploy --app headless-three-prod --remote-only --build-arg 'GIT_COMMIT=${{ github.sha }}' --build-arg 'GIT_TAG=${{ github.ref_name }}'