1- name : MT Deploy Production
1+ name : Deploy Production
22on :
3- push :
4- branches :
5- - release
6-
3+ pull_request :
4+ types : [closed]
5+ branches :
6+ - ' releases/latest'
7+
78jobs :
8- release :
9- runs-on : ubuntu-20.04
10- outputs :
11- published : ${{ steps.semantic.outputs.new_release_published }}
12- version : ${{ steps.semantic.outputs.new_release_version }}
13- steps :
14- - uses : actions/checkout@v3
15- - id : semantic
16- uses : cycjimmy/semantic-release-action@v3
17- with :
18- semantic_version : 18
19- env :
20- GITHUB_TOKEN : ${{ secrets.GH_TOKEN_PROJECT_ACTION }}
21-
229 deploy :
23- needs : release
10+ if : github.event.pull_request.merged == true
2411 runs-on : ubuntu-20.04
25- if : needs.release.outputs.published == 'true'
2612 steps :
2713 - uses : actions/checkout@v2
2814 - uses : superfly/flyctl-actions@1.1
2915 with :
3016 args : " -c deploy/fly/prod.toml deploy --build-arg SLOT_NAME_SUFFIX=${GITHUB_SHA::7}"
3117 env :
32- FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
33-
34- docker_x86_release :
35- needs : release
36- runs-on : ubuntu-20.04
37- if : needs.release.outputs.published == 'true'
38- timeout-minutes : 120
39- env :
40- arch : amd64
41- outputs :
42- image_digest : ${{ steps.build.outputs.digest }}
43- steps :
44- - id : meta
45- uses : docker/metadata-action@v4
46- with :
47- images : |
48- supabase/realtime
49- tags : |
50- type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}
51-
52- - uses : docker/setup-buildx-action@v2
53-
54- - uses : docker/login-action@v2
55- with :
56- username : ${{ secrets.DOCKER_USERNAME }}
57- password : ${{ secrets.DOCKER_PASSWORD }}
58-
59- - id : build
60- uses : docker/build-push-action@v3
61- with :
62- push : true
63- tags : ${{ steps.meta.outputs.tags }}
64- platforms : linux/${{ env.arch }}
65- cache-from : type=gha
66- cache-to : type=gha,mode=max
67-
68- docker_arm_release :
69- needs : release
70- runs-on : arm-runner
71- if : needs.release.outputs.published == 'true'
72- timeout-minutes : 120
73- env :
74- arch : arm64
75- outputs :
76- image_digest : ${{ steps.build.outputs.digest }}
77- steps :
78- - uses : actions/checkout@v3
79-
80- - id : meta
81- uses : docker/metadata-action@v4
82- with :
83- images : |
84- supabase/realtime
85- tags : |
86- type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}
87-
88- - uses : docker/login-action@v2
89- with :
90- username : ${{ secrets.DOCKER_USERNAME }}
91- password : ${{ secrets.DOCKER_PASSWORD }}
92-
93- - uses : docker/setup-buildx-action@v2
94- with :
95- driver : docker
96- driver-opts : |
97- image=moby/buildkit:master
98- network=host
99-
100- - id : build
101- uses : docker/build-push-action@v3
102- with :
103- context : .
104- push : true
105- tags : ${{ steps.meta.outputs.tags }}
106- platforms : linux/${{ env.arch }}
107- no-cache : true
108-
109- merge_manifest :
110- needs : [release, docker_x86_release, docker_arm_release]
111- runs-on : ubuntu-latest
112- permissions :
113- contents : read
114- packages : write
115- id-token : write
116- steps :
117- - uses : docker/setup-buildx-action@v2
118-
119- - uses : docker/login-action@v2
120- with :
121- username : ${{ secrets.DOCKER_USERNAME }}
122- password : ${{ secrets.DOCKER_PASSWORD }}
123-
124- - name : Merge multi-arch manifests
125- run : |
126- docker buildx imagetools create -t supabase/realtime:v${{ needs.release.outputs.version }} \
127- supabase/realtime@${{ needs.docker_x86_release.outputs.image_digest }} \
128- supabase/realtime@${{ needs.docker_arm_release.outputs.image_digest }}
129-
130- - name : configure aws credentials
131- uses : aws-actions/configure-aws-credentials@v1
132- with :
133- role-to-assume : ${{ secrets.PROD_AWS_ROLE }}
134- aws-region : us-east-1
135-
136- - name : Login to ECR
137- uses : docker/login-action@v2
138- with :
139- registry : public.ecr.aws
140-
141- - name : Login to GHCR
142- uses : docker/login-action@v2
143- with :
144- registry : ghcr.io
145- username : ${{ github.actor }}
146- password : ${{ secrets.GITHUB_TOKEN }}
147-
148- - name : Mirror to ECR
149- uses : akhilerm/tag-push-action@v2.0.0
150- with :
151- src : docker.io/supabase/realtime:v${{ needs.release.outputs.version }}
152- dst : |
153- public.ecr.aws/supabase/realtime:v${{ needs.release.outputs.version }}
154- ghcr.io/supabase/realtime:v${{ needs.release.outputs.version }}
18+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
0 commit comments