1- name : Build and push
1+ name : docker-build
22
33on :
44 push :
77 tags :
88 - " v[0-9]+.[0-9]+.[0-9]+"
99
10- env :
11- REGISTRY_IMAGE : netfloex/quickadd
12-
1310jobs :
1411 tests :
1512 runs-on : ubuntu-latest
1613 steps :
1714 - name : Setup yarn and install dependencies
1815 uses : netfloex/actions/yarn@master
1916 with :
20- node-version : 18.18 .0
17+ node-version : 22.14 .0
2118
2219 - name : Check Types
2320 run : yarn typescript
2421
2522 - name : Test ESLint
2623 run : yarn lint
2724
28- build :
29- needs :
30- - tests
31- runs-on : ubuntu-latest
25+ docker :
3226 strategy :
33- fail-fast : false
3427 matrix :
35- platform :
36- - linux/amd64
37- - linux/arm64
38- steps :
39- - name : Prepare
40- run : |
41- platform=${{ matrix.platform }}
42- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
28+ include :
29+ - os : ubuntu-latest
30+ arch : amd64
31+ - os : ubuntu-24.04-arm
32+ arch : arm64
4333
44- - name : Checkout
45- uses : actions/checkout@v4
34+ runs-on : ${{ matrix.os }}
35+ needs : tests
4636
37+ steps :
4738 - name : Docker meta
4839 id : meta
49- uses : docker/metadata-action@v5
40+ uses : docker/metadata-action@v4
5041 with :
51- images : ${{ env.REGISTRY_IMAGE }}
42+ images : |
43+ ${{ vars.REGISTRY_IMAGE }}
5244 tags : |
5345 type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
5446 type=semver,pattern=v{{major}}.{{minor}}
5547 type=semver,pattern=v{{major}}
5648 type=raw,value=latest
5749
58- - name : Set up QEMU
59- uses : docker/setup-qemu-action@v3
60-
6150 - name : Set up Docker Buildx
6251 uses : docker/setup-buildx-action@v3
6352
6453 - name : Login to Docker Hub
6554 uses : docker/login-action@v3
6655 with :
67- username : ${{ secrets .DOCKERHUB_USERNAME }}
56+ username : ${{ vars .DOCKERHUB_USERNAME }}
6857 password : ${{ secrets.DOCKERHUB_TOKEN }}
6958
7059 - name : Build and push by digest
7160 id : build
7261 uses : docker/build-push-action@v5
7362 with :
74- context : .
75- platforms : ${{ matrix.platform }}
63+ platforms : ${{ matrix.arch }}
7664 labels : ${{ steps.meta.outputs.labels }}
77- outputs : type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
65+ outputs : type=image,name=${{ vars.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
66+
7867 cache-from : type=gha
7968 cache-to : type=gha,mode=max
8069
@@ -84,18 +73,20 @@ jobs:
8473 digest="${{ steps.build.outputs.digest }}"
8574 touch "/tmp/digests/${digest#sha256:}"
8675
76+ # Create platform variable with a / changed to - (e.g. linux/amd64 to linux-amd64)
77+ platform=linux/${{ matrix.arch }}
78+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
79+
8780 - name : Upload digest
8881 uses : actions/upload-artifact@v4
8982 with :
9083 name : digests-${{ env.PLATFORM_PAIR }}
9184 path : /tmp/digests/*
9285 if-no-files-found : error
9386 retention-days : 1
94-
9587 merge :
9688 runs-on : ubuntu-latest
97- needs :
98- - build
89+ needs : docker
9990 steps :
10091 - name : Download digests
10192 uses : actions/download-artifact@v4
@@ -104,14 +95,11 @@ jobs:
10495 pattern : digests-*
10596 merge-multiple : true
10697
107- - name : Set up Docker Buildx
108- uses : docker/setup-buildx-action@v3
109-
11098 - name : Docker meta
11199 id : meta
112100 uses : docker/metadata-action@v5
113101 with :
114- images : ${{ env .REGISTRY_IMAGE }}
102+ images : ${{ vars .REGISTRY_IMAGE }}
115103 tags : |
116104 type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
117105 type=semver,pattern=v{{major}}.{{minor}}
@@ -121,15 +109,11 @@ jobs:
121109 - name : Login to Docker Hub
122110 uses : docker/login-action@v3
123111 with :
124- username : netfloex
112+ username : ${{ vars.DOCKERHUB_USERNAME }}
125113 password : ${{ secrets.DOCKERHUB_TOKEN }}
126114
127115 - name : Create manifest list and push
128116 working-directory : /tmp/digests
129117 run : |
130118 docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
131- $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
132-
133- - name : Inspect image
134- run : |
135- docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
119+ $(printf '${{ vars.REGISTRY_IMAGE }}@sha256:%s ' *)
0 commit comments