-
Notifications
You must be signed in to change notification settings - Fork 11
171 lines (158 loc) · 6.18 KB
/
generate-docker-images.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Update Docker Images
on:
workflow_dispatch:
schedule:
- cron: "50 6 * * 0-6"
push:
tags:
- "*.*.*"
branches:
- "release/*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
AWS_REGION: us-east-1
jobs:
generate-docker-images:
runs-on: ubuntu-latest
steps:
- name: Force Install GIT latest
run: |
sudo apt-get install -y software-properties-common \
&& sudo apt-get update \
&& sudo add-apt-repository -y ppa:git-core/ppa \
&& sudo apt-get update \
&& sudo apt-get install -y git \
&& git --version
- name: Checkout code
uses: actions/checkout@v4
- name: Get commit date for the triggering commit
run: |
COMMIT_DATE=$(git show -s --format="%cd" ${{ github.sha }})
echo "COMMIT_DATE=$COMMIT_DATE" >> $GITHUB_ENV
# Checkout the repository to the GitHub Actions runner
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Check release tag
id: release-tag
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: 'refs/tags/[0-9]{4}\.[0-9]+\.[0-9]+$'
- name: Check release candidate tag
id: release-candidate-tag
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: 'refs/tags/[0-9]{4}\.[0-9]+\.[0-9]+-rc[0-9]+$'
- name: Build and push edge nextjs
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
file: frontend/apps/site/Dockerfile
tags: mintter/sitegw:main
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SITE_SENTRY_DSN=${{ secrets.SITE_SENTRY_DSN }}
- name: Build and push rc nextjs
if: (startsWith(github.ref, 'refs/tags/') && (steps.release-candidate-tag.outputs.match || steps.release-tag.outputs.match)) || startsWith(github.ref, 'refs/heads/release/')
uses: docker/build-push-action@v4
with:
push: true
file: frontend/apps/site/Dockerfile
tags: mintter/sitegw:rc
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SITE_SENTRY_DSN=${{ secrets.SITE_SENTRY_DSN }}
- name: Build and push stable nextjs
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
file: frontend/apps/site/Dockerfile
tags: mintter/sitegw:latest
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SITE_SENTRY_DSN=${{ secrets.SITE_SENTRY_DSN }}
- name: Build and push edge mintter-site
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
file: backend/cmd/mintter-site/Dockerfile
tags: mintter/mintter-site:main
- name: Build and push rc mintter-site
if: (startsWith(github.ref, 'refs/tags/') && (steps.release-candidate-tag.outputs.match || steps.release-tag.outputs.match)) || startsWith(github.ref, 'refs/heads/release/')
uses: docker/build-push-action@v4
with:
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
file: backend/cmd/mintter-site/Dockerfile
tags: mintter/mintter-site:rc
- name: Build and push stable mintter-site
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
file: backend/cmd/mintter-site/Dockerfile
tags: mintter/mintter-site:latest
- name: Build and push edge monitord
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/monitord/Dockerfile
tags: mintter/monitord:main
- name: Build and push rc monitord
if: (startsWith(github.ref, 'refs/tags/') && (steps.release-candidate-tag.outputs.match || steps.release-tag.outputs.match)) || startsWith(github.ref, 'refs/heads/release/')
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/monitord/Dockerfile
tags: mintter/monitord:rc
- name: Build and push stable monitord
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/monitord/Dockerfile
tags: mintter/monitord:latest
- name: Build and push edge relay
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/relayd/Dockerfile
tags: mintter/relayd:main
- name: Build and push rc relay
if: (startsWith(github.ref, 'refs/tags/') && (steps.release-candidate-tag.outputs.match || steps.release-tag.outputs.match)) || startsWith(github.ref, 'refs/heads/release/')
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/relayd/Dockerfile
tags: mintter/relayd:rc
- name: Build and push stable relay
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/relayd/Dockerfile
tags: mintter/relayd:latest