-
Notifications
You must be signed in to change notification settings - Fork 38
258 lines (256 loc) · 9.19 KB
/
build.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: build
on:
push:
branches:
- master
paths:
- Dockerfile
- .github/workflows/build.yml
- root/**
pull_request:
branches:
- master
paths:
- Dockerfile
- .github/workflows/build.yml
- root/**
repository_dispatch:
types:
- upstream_image_update
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
env:
TITLE: Red-DiscordBot
GHCR_SLUG: ghcr.io/phasecorex/red-discordbot
DOCK_SLUG: docker.io/phasecorex/red-discordbot
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_SLUG }}
${{ env.DOCK_SLUG }}
labels: |
maintainer=${{ github.repository_owner }}
org.opencontainers.image.vendor=${{ github.repository_owner }}
org.opencontainers.image.title=${{ env.TITLE }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push extra-audio
uses: docker/build-push-action@v6
with:
target: extra-audio
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_SLUG }}:full-py311
${{ env.DOCK_SLUG }}:full-py311
${{ env.GHCR_SLUG }}:full
${{ env.DOCK_SLUG }}:full
${{ env.GHCR_SLUG }}:extra-audio-py311
${{ env.DOCK_SLUG }}:extra-audio-py311
${{ env.GHCR_SLUG }}:extra-audio
${{ env.DOCK_SLUG }}:extra-audio
build-args: |
PCX_DISCORDBOT_BUILD=${{ github.run_id }}
PCX_DISCORDBOT_COMMIT=${{ github.sha }}
cache-from: |
${{ env.GHCR_SLUG }}:extra-audio
labels: ${{ steps.meta.outputs.labels }}
-
name: Build and push core
uses: docker/build-push-action@v6
with:
target: core
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_SLUG }}:noaudio-py311
${{ env.DOCK_SLUG }}:noaudio-py311
${{ env.GHCR_SLUG }}:noaudio
${{ env.DOCK_SLUG }}:noaudio
${{ env.GHCR_SLUG }}:core-py311
${{ env.DOCK_SLUG }}:core-py311
${{ env.GHCR_SLUG }}:core
${{ env.DOCK_SLUG }}:core
build-args: |
PCX_DISCORDBOT_BUILD=${{ github.run_id }}
PCX_DISCORDBOT_COMMIT=${{ github.sha }}
cache-from: |
${{ env.GHCR_SLUG }}:extra-audio
labels: ${{ steps.meta.outputs.labels }}
-
name: Build and push extra
uses: docker/build-push-action@v6
with:
target: extra
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_SLUG }}:extra-py311
${{ env.DOCK_SLUG }}:extra-py311
${{ env.GHCR_SLUG }}:extra
${{ env.DOCK_SLUG }}:extra
build-args: |
PCX_DISCORDBOT_BUILD=${{ github.run_id }}
PCX_DISCORDBOT_COMMIT=${{ github.sha }}
cache-from: |
${{ env.GHCR_SLUG }}:extra-audio
labels: ${{ steps.meta.outputs.labels }}
-
name: Build and push core-audio
uses: docker/build-push-action@v6
with:
target: core-audio
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_SLUG }}:audio-py311
${{ env.DOCK_SLUG }}:audio-py311
${{ env.GHCR_SLUG }}:audio
${{ env.DOCK_SLUG }}:audio
${{ env.GHCR_SLUG }}:core-audio-py311
${{ env.DOCK_SLUG }}:core-audio-py311
${{ env.GHCR_SLUG }}:core-audio
${{ env.DOCK_SLUG }}:core-audio
${{ env.GHCR_SLUG }}:latest
${{ env.DOCK_SLUG }}:latest
build-args: |
PCX_DISCORDBOT_BUILD=${{ github.run_id }}
PCX_DISCORDBOT_COMMIT=${{ github.sha }}
cache-from: |
${{ env.GHCR_SLUG }}:core
${{ env.GHCR_SLUG }}:core-audio
labels: ${{ steps.meta.outputs.labels }}
-
name: Build and push core-pylav
uses: docker/build-push-action@v6
with:
target: core-pylav
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_SLUG }}:pylav
${{ env.DOCK_SLUG }}:pylav
${{ env.GHCR_SLUG }}:core-pylav
${{ env.DOCK_SLUG }}:core-pylav
${{ env.GHCR_SLUG }}:latest-pylav
${{ env.DOCK_SLUG }}:latest-pylav
build-args: |
PCX_DISCORDBOT_BUILD=${{ github.run_id }}
PCX_DISCORDBOT_COMMIT=${{ github.sha }}
cache-from: |
${{ env.GHCR_SLUG }}:core-audio
${{ env.GHCR_SLUG }}:core-pylav
labels: ${{ steps.meta.outputs.labels }}
-
name: Build and push extra-pylav
uses: docker/build-push-action@v6
with:
target: extra-pylav
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.GHCR_SLUG }}:full-pylav
${{ env.DOCK_SLUG }}:full-pylav
${{ env.GHCR_SLUG }}:extra-pylav
${{ env.DOCK_SLUG }}:extra-pylav
build-args: |
PCX_DISCORDBOT_BUILD=${{ github.run_id }}
PCX_DISCORDBOT_COMMIT=${{ github.sha }}
cache-from: |
${{ env.GHCR_SLUG }}:extra-audio
${{ env.GHCR_SLUG }}:core-pylav
${{ env.GHCR_SLUG }}:extra-pylav
labels: ${{ steps.meta.outputs.labels }}
-
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:core
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:extra
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:core-audio
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:extra-audio
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:core-pylav
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:extra-pylav
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:core
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:extra
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:core-audio
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:extra-audio
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:core-pylav
docker buildx imagetools inspect ${{ env.DOCK_SLUG }}:extra-pylav
-
name: Check pull
if: github.event_name != 'pull_request'
run: |
docker pull ${{ env.GHCR_SLUG }}:core
docker pull ${{ env.GHCR_SLUG }}:extra
docker pull ${{ env.GHCR_SLUG }}:core-audio
docker pull ${{ env.GHCR_SLUG }}:extra-audio
docker pull ${{ env.GHCR_SLUG }}:core-pylav
docker pull ${{ env.GHCR_SLUG }}:extra-pylav
docker image inspect ${{ env.GHCR_SLUG }}:core
docker image inspect ${{ env.GHCR_SLUG }}:extra
docker image inspect ${{ env.GHCR_SLUG }}:core-audio
docker image inspect ${{ env.GHCR_SLUG }}:extra-audio
docker image inspect ${{ env.GHCR_SLUG }}:core-pylav
docker image inspect ${{ env.GHCR_SLUG }}:extra-pylav
docker pull ${{ env.DOCK_SLUG }}:core
docker pull ${{ env.DOCK_SLUG }}:extra
docker pull ${{ env.DOCK_SLUG }}:core-audio
docker pull ${{ env.DOCK_SLUG }}:extra-audio
docker pull ${{ env.DOCK_SLUG }}:core-pylav
docker pull ${{ env.DOCK_SLUG }}:extra-pylav
docker image inspect ${{ env.DOCK_SLUG }}:core
docker image inspect ${{ env.DOCK_SLUG }}:extra
docker image inspect ${{ env.DOCK_SLUG }}:core-audio
docker image inspect ${{ env.DOCK_SLUG }}:extra-audio
docker image inspect ${{ env.DOCK_SLUG }}:core-pylav
docker image inspect ${{ env.DOCK_SLUG }}:extra-pylav