-
Notifications
You must be signed in to change notification settings - Fork 23
617 lines (607 loc) · 23.8 KB
/
container-build-publish.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
name: 'Docker: build and publish container images'
on:
push:
branches:
- master
paths-ignore:
- 'doc/**'
- 'examples/**'
- 'Formula/**'
- 'tools/get-version'
- 'windows/**'
- '**.md'
schedule:
- cron: '22 2 */6 * *' # every 6 days to avoid gha cache being evicted
pull_request:
paths-ignore:
- 'doc/**'
- 'examples/**'
- 'Formula/**'
- 'tools/get-version'
- 'windows/**'
- '**.md'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKERHUB_REPO: eturnal/eturnal
PKGREL_FILE: tools/ctrrel
jobs:
################################################################################
#' check whether to compile from master branch or from tagged version
detect-change:
name: Check ctr version change
runs-on: ubuntu-latest
outputs:
update: ${{ steps.check_version_changed.outputs.update }}
steps:
-
name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 2
-
name: Compare ctr package-release vsn between commits
id: check_version_changed
run: |
TAG_PKGREL=$(awk 'END{print}' ${{ env.PKGREL_FILE }})
git checkout HEAD^
TAG_PKGREL_BASELINE=$(awk 'END{print}' ${{ env.PKGREL_FILE }})
if [ "$TAG_PKGREL" != "$TAG_PKGREL_BASELINE" ]
then echo "update=true" >> $GITHUB_OUTPUT
else echo "update=false" >> $GITHUB_OUTPUT
fi
################################################################################
#' build musl-libc based binary tarballs for x64/arm64
build-musl-binary-archives:
name: ${{ matrix.arch }} - build musl-libc based binary archives
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64, arm64]
fail-fast: false
needs: [detect-change]
steps:
-
name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Cache toolchain directory
uses: actions/cache@v4
with:
path: ~/build/
key: ${{runner.os}}-ct-ng-1.25.0-${{ matrix.arch }}-musl
-
name: On push master | extract git version
if: needs.detect-change.outputs.update == 'false'
run: echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tag
if: needs.detect-change.outputs.update == 'true'
run: echo "TAG_VERSION=$(awk 'END{gsub("-", " "); print $1}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
-
name: On release | check out release to be published/updated
uses: actions/checkout@v4
if: needs.detect-change.outputs.update == 'true'
with:
ref: ${{ env.TAG_VERSION }}
-
name: Install prerequisites, obtain erlang/otp version & target arch ...
run: |
sudo apt-get -qq update
# https://github.com/crosstool-ng/crosstool-ng/blob/master/testing/docker/ubuntu22.04/Dockerfile
sudo apt-get -qq install makeself build-essential \
gcc g++ gperf bison flex texinfo help2man make libncurses5-dev \
python3-dev autoconf automake libtool libtool-bin gawk wget bzip2 \
xz-utils unzip patch libstdc++6 rsync git meson ninja-build \
binfmt-support qemu-user-static
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
echo "ARCH=$(echo ${{ matrix.arch }} | sed -e 's|x64|x86_64|;s|arm64|aarch64|')" >> $GITHUB_ENV
-
name: Install erlang/OTP
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VSN }}
version-type: strict
-
name: Build ${{ matrix.arch }} musl-libc based binary archives
run: CHECK_DEPS=false tools/make-binaries ${{ env.ARCH }}-linux-musl
-
name: Start container for rebar3 test suites ...
run: |
rebar3_path="$HOME/build/bootstrap/bin"
otp_path="$HOME/build/eturnal/${{ env.ARCH }}-linux-musl/bin"
alpine_path='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
arch=$(echo ${{ matrix.arch }} | sed -e 's|x64|amd64|')
docker run --init -d --name test-suites \
--platform linux/$arch \
-v $HOME/build:$HOME/build \
-v $PWD:/eturnal \
--workdir /eturnal \
-e PATH=$rebar3_path:$otp_path:$alpine_path \
docker.io/alpine:latest \
sleep 600
- # add build-tools & git, if rebar.config uses e.g. "github" as source
name: add build tools to the container ...
run: docker exec test-suites apk add build-base git yaml-dev
-
name: rebar3 xref ...
run: docker exec test-suites rebar3 xref
-
name: rebar3 eunit ...
run: docker exec test-suites rebar3 eunit
-
name: rebar3 ct ...
run: docker exec test-suites rebar3 ct
-
name: Stop rebar3 test container ...
run: docker stop test-suites
-
name: Upload artifact | ${{ matrix.arch }} musl-libc based binary tarball
uses: actions/upload-artifact@v4
with:
name: eturnal-${{ env.TAG_VERSION }}-linux-musl-${{ matrix.arch }}.tar.gz
path: eturnal-*-linux-musl-${{ matrix.arch }}.tar.gz
if-no-files-found: error
retention-days: 15
################################################################################
#' build actual images for x64/arm64 with built binary tarballs
build-ctr-binary-based:
name: ${{ matrix.arch }} - ${{ matrix.method }}-based variant
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64, arm64]
method: [package]
fail-fast: false
needs: [detect-change, build-musl-binary-archives]
steps:
-
name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: On push master | extract git version
if: needs.detect-change.outputs.update == 'false'
run: echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tag
if: needs.detect-change.outputs.update == 'true'
run: echo "TAG_VERSION=$(awk 'END{gsub("-", " "); print $1}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Extract build & environment variables
run: |
echo "DOCKERFILE_PATH=$(dirname $(find . -name Dockerfile))" >> $GITHUB_ENV
echo "ARCH=$(echo ${{ matrix.arch }} | sed -e 's|x64|amd64|')" >> $GITHUB_ENV
-
name: Download artifact | ${{ matrix.arch }} musl-libc based binary tarball
uses: actions/download-artifact@v4
with:
name: eturnal-${{ env.TAG_VERSION }}-linux-musl-${{ matrix.arch }}.tar.gz
-
name: Log in to ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Standalone | build & push by digest
id: build-so
uses: docker/build-push-action@v5
with:
build-args: |
METHOD=${{ matrix.method }}
VERSION=${{ env.TAG_VERSION }}
REPOSITORY=https://github.com/${{ github.repository }}.git
VARIANT=standalone
context: .
file: ${{ env.DOCKERFILE_PATH }}/Dockerfile
platforms: linux/${{ env.ARCH }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
name: Simple smoke test
run: |
set -x
docker run -d --name eturnal \
--platform linux/${{ env.ARCH }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-so.outputs.digest }} \
sleep 600
docker exec eturnal eturnalctl daemon
docker exec eturnal eturnalctl ping
docker exec eturnal eturnalctl info
docker logs eturnal
docker stop eturnal
-
name: Standalone | export digest | ${{ matrix.arch }}
run: |
mkdir -p /tmp/digests-so
digest="${{ steps.build-so.outputs.digest }}"
touch "/tmp/digests-so/${digest#sha256:}"
-
name: Standalone | upload digest | ${{ matrix.arch }}
uses: actions/upload-artifact@v4
with:
name: digests-standalone-${{ matrix.arch }}
path: /tmp/digests-so/*
if-no-files-found: error
retention-days: 5
-
name: ACME | build & push by digest
id: build-as
uses: docker/build-push-action@v5
with:
build-args: |
METHOD=${{ matrix.method }}
VERSION=${{ env.TAG_VERSION }}
REPOSITORY=https://github.com/${{ github.repository }}.git
VARIANT=acme
context: .
file: ${{ env.DOCKERFILE_PATH }}/Dockerfile
platforms: linux/${{ env.ARCH }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
name: ACME | export digest | ${{ matrix.arch }}
run: |
mkdir -p /tmp/digests-as
digest="${{ steps.build-as.outputs.digest }}"
touch "/tmp/digests-as/${digest#sha256:}"
-
name: ACME | upload digest | ${{ matrix.arch }}
uses: actions/upload-artifact@v4
with:
name: digests-acme-${{ matrix.arch }}
path: /tmp/digests-as/*
if-no-files-found: error
retention-days: 5
################################################################################
#' build Erlang/OTP and rebar3 for directly compilation.
build-erlang-rebar:
name: Build Erlang/OTP and Rebar3
runs-on: ubuntu-latest
needs: [detect-change]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
-
name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: On push master | extract git version and define build mode
if: needs.detect-change.outputs.update == 'false'
run: |
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
echo "REBAR_VSN=$(awk '/^rebar_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
-
name: On release | extract git version and define build mode
if: needs.detect-change.outputs.update == 'true'
run: |
echo "OTP_VSN=$(wget -O - https://raw.githubusercontent.com/${{ github.repository }}/$eturnal_vsn/tools/make-binaries \
| awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}')" >> $GITHUB_ENV
echo "REBAR_VSN=$(wget -O - https://raw.githubusercontent.com/${{ github.repository }}/$eturnal_vsn/tools/make-binaries \
| awk '/^rebar_vsn=/ {{gsub(/[^0-9.]/, ""); print}}')" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
-
name: Build Erlang/OTP ${{ env.OTP_VSN }} base image
uses: docker/build-push-action@v5
with:
build-args: |
OTP_VSN=${{ env.OTP_VSN }}
REBAR_VSN=${{ env.REBAR_VSN }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: tools/Dockerfile.erlang
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/386,linux/arm/v7,linux/ppc64le
push: true
tags: localhost:5000/erlang:otp-${{ env.OTP_VSN }}
################################################################################
#' build container images with local source files
build-ctr:
name: ${{ matrix.arch }} - ${{ matrix.method }}-based variant
runs-on: ubuntu-latest
strategy:
matrix:
arch: [386, arm/v7, ppc64le]
method: [build]
fail-fast: false
needs: [detect-change, build-erlang-rebar]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
-
name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: On push master | extract git version and define build mode
if: needs.detect-change.outputs.update == 'false'
run: |
echo "VSN=$(git describe --tag)" >> $GITHUB_ENV
echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
echo "SRC=local" >> $GITHUB_ENV
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
echo "REBAR_VSN=$(awk '/^rebar_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
echo "ARCH=$(echo ${{ matrix.arch }} | sed -e 's|/|-|')" >> $GITHUB_ENV
-
name: On release | extract git version and define build mode
if: needs.detect-change.outputs.update == 'true'
run: |
eturnal_vsn=$(awk 'END{gsub("-", " "); print $1}' ${{ env.PKGREL_FILE }})
echo "VSN=$eturnal_vsn" >> $GITHUB_ENV
echo "TAG_VERSION=$(awk 'END{gsub("-", " "); print $1}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
# define erlang/OTP version
echo "OTP_VSN=$(wget -O - https://raw.githubusercontent.com/${{ github.repository }}/$eturnal_vsn/tools/make-binaries \
| awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}')" >> $GITHUB_ENV
echo "REBAR_VSN=$(wget -O - https://raw.githubusercontent.com/${{ github.repository }}/$eturnal_vsn/tools/make-binaries \
| awk '/^rebar_vsn=/ {{gsub(/[^0-9.]/, ""); print}}')" >> $GITHUB_ENV
# check whether to build from archive or git, because git repo is HEAD here
# hence, we would not build the specifc release when updating the ctr image
pkgrel=$(awk 'END{gsub("-", " "); print $2}' ${{ env.PKGREL_FILE }})
if [ "$pkgrel" != 'r0' ]
then echo "SRC=web" >> $GITHUB_ENV
else echo "SRC=local" >> $GITHUB_ENV
fi
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
-
name: Build Erlang/OTP ${{ env.OTP_VSN }} base image
uses: docker/build-push-action@v5
with:
build-args: |
OTP_VSN=${{ env.OTP_VSN }}
REBAR_VSN=${{ env.REBAR_VSN }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: tools/Dockerfile.erlang
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/386,linux/arm/v7,linux/ppc64le
push: true
tags: localhost:5000/erlang:otp-${{ env.OTP_VSN }}
-
name: Extract build & environment variables
run: |
echo "DOCKERFILE_PATH=$(dirname $(find . -name Dockerfile))" >> $GITHUB_ENV
# Check if rebar3 common test should be performed
# fix for slow architectures was introduces after version 1.10.1
if dpkg --compare-versions ${{ env.TAG_VERSION }} le "1.10.1"
then echo "REBAR_CT=false" >> $GITHUB_ENV
else echo "REBAR_CT=true" >> $GITHUB_ENV
fi
-
name: Log in to ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Standalone | build & push by digest
id: build-so
uses: docker/build-push-action@v5
with:
build-args: |
SOURCE=${{ env.SRC }}
VERSION=${{ env.VSN }}
BUILD_IMAGE=localhost:5000/erlang:otp-${{ env.OTP_VSN }}
REPOSITORY=https://github.com/${{ github.repository }}.git
REBAR_CT=${{ env.REBAR_CT }}
VARIANT=standalone
context: .
file: ${{ env.DOCKERFILE_PATH }}/Dockerfile
platforms: linux/${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
name: Simple smoke test
run: |
set -x
docker run -d --name eturnal \
--platform linux/${{ matrix.ARCH }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-so.outputs.digest }} \
sleep 600
docker exec eturnal eturnalctl daemon
docker exec eturnal eturnalctl ping
docker exec eturnal eturnalctl info
docker logs eturnal
docker stop eturnal
-
name: Standalone | export digest | ${{ matrix.arch }}
run: |
mkdir -p /tmp/digests-so
digest="${{ steps.build-so.outputs.digest }}"
touch "/tmp/digests-so/${digest#sha256:}"
-
name: Standalone | upload digest | ${{ matrix.arch }}
uses: actions/upload-artifact@v4
with:
name: digests-standalone-${{ env.ARCH }}
path: /tmp/digests-so/*
if-no-files-found: error
retention-days: 5
-
name: ACME | build & push by digest
id: build-as
uses: docker/build-push-action@v5
with:
build-args: |
SOURCE=${{ env.SRC }}
VERSION=${{ env.VSN }}
BUILD_IMAGE=localhost:5000/erlang:otp-${{ env.OTP_VSN }}
REPOSITORY=https://github.com/${{ github.repository }}.git
REBAR_CT=${{ env.REBAR_CT }}
VARIANT=acme
context: .
file: ${{ env.DOCKERFILE_PATH }}/Dockerfile
platforms: linux/${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
-
name: ACME | export digest | ${{ matrix.arch }}
run: |
mkdir -p /tmp/digests-as
digest="${{ steps.build-as.outputs.digest }}"
touch "/tmp/digests-as/${digest#sha256:}"
-
name: ACME | upload digest | ${{ matrix.arch }}
uses: actions/upload-artifact@v4
with:
name: digests-acme-${{ env.ARCH }}
path: /tmp/digests-as/*
if-no-files-found: error
retention-days: 5
################################################################################
## merge single images to only advertise one image plus tag
publish:
name: ${{ matrix.registry }} - publish manifest ${{ matrix.variant }} variant
runs-on: ubuntu-latest
strategy:
matrix:
registry: [ghcr.io, docker.io]
variant: [standalone, acme]
fail-fast: false
if: github.event_name != 'pull_request' && github.event_name != 'schedule'
needs: [detect-change, build-musl-binary-archives, build-ctr-binary-based, build-ctr]
steps:
-
name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: On push master | extract git version and define build variants
if: needs.detect-change.outputs.update == 'false'
run: |
echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tags to be published/updated
if: needs.detect-change.outputs.update == 'true'
run: |
echo "TAG_PKGREL=$(awk 'END{print}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
echo "TAG_VERSION=$(awk 'END{gsub("-", " "); print $1}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
echo "TAG_MINOR=$(awk 'END{gsub("\\.", " "); print $1"."$2}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
echo "TAG_MAJOR=$(awk 'END{gsub("\\.", " "); print $1}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
-
name: Log in to ${{ matrix.registry }}
uses: docker/login-action@v3
if: |
( matrix.registry == 'docker.io'
&& github.repository_owner == 'processone' )
|| matrix.registry == 'ghcr.io'
with:
registry: ${{ matrix.registry }}
username: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_USERNAME)
|| github.repository_owner }}
password: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_TOKEN)
|| secrets.GITHUB_TOKEN }}
-
name: Download digests | ${{ matrix.variant }}
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-${{ matrix.variant }}-*
merge-multiple: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Define tag for latest ...
run: |
if [ ${{ matrix.variant }} = 'standalone' ]
then echo "TAG_LATEST=latest" >> $GITHUB_ENV
else echo "TAG_LATEST=${{ matrix.variant }}" >> $GITHUB_ENV
fi
-
name: For variant == 'acme' add a special tag suffix
if: matrix.variant == 'acme'
run: echo "TAG_ACME=-acme" >> $GITHUB_ENV
-
name: On push master | Docker meta
id: meta
if: needs.detect-change.outputs.update == 'false'
uses: docker/metadata-action@v5
with:
images: ${{ matrix.registry }}/${{ (matrix.registry == 'docker.io'
&& env.DOCKERHUB_REPO)
|| env.IMAGE_NAME }}
tags: |
edge${{ env.TAG_ACME }}
-
name: On release | Docker meta
id: meta-rel
if: needs.detect-change.outputs.update == 'true'
uses: docker/metadata-action@v5
with:
images: ${{ matrix.registry }}/${{ (matrix.registry == 'docker.io'
&& env.DOCKERHUB_REPO)
|| env.IMAGE_NAME }}
tags: |
${{ env.TAG_LATEST }}
${{ env.TAG_PKGREL }}${{ env.TAG_ACME }}
${{ env.TAG_VERSION }}${{ env.TAG_ACME }}
${{ env.TAG_MINOR }}${{ env.TAG_ACME }}
${{ env.TAG_MAJOR }}${{ env.TAG_ACME }}
-
name: Create manifest list and push
if: |
( matrix.registry == 'docker.io'
&& github.repository_owner == 'processone' )
|| matrix.registry == 'ghcr.io'
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -r '"-t " + (.tags | join(" -t "))' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
-
name: Inspect image
if: matrix.registry == 'ghcr.io'
run: |
docker buildx imagetools inspect ${{ matrix.registry }}/${{ env.IMAGE_NAME }}:${{ steps.meta-rel.outputs.version }} ||
docker buildx imagetools inspect ${{ matrix.registry }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}