2121 REGISTRY : ghcr.io
2222 # github.repository as <account>/<repo>
2323 IMAGE_NAME : ${{ github.repository }}
24+ IMAGE_PLATFORMS : linux/amd64,linux/arm64,linux/arm/v7
2425
2526
2627jobs :
28+ # gate: don't build or publish anything unless the tests pass
29+ test :
30+ runs-on : ubuntu-latest
31+ steps :
32+ - name : Checkout repository
33+ uses : actions/checkout@v5
34+ - name : Run tests
35+ run : ./test.sh
36+
2737 build :
38+ needs : test
2839
2940 runs-on : ubuntu-latest
3041 permissions :
@@ -36,20 +47,25 @@ jobs:
3647
3748 steps :
3849 - name : Checkout repository
39- uses : actions/checkout@v4
50+ uses : actions/checkout@v5
4051
4152 - name : Install Cosign
4253 uses : sigstore/cosign-installer@v3.5.0
4354
55+ - name : Set up QEMU
56+ uses : docker/setup-qemu-action@v4
57+ with :
58+ platforms : ${{ env.IMAGE_PLATFORMS }}
59+
4460 # Workaround: https://github.com/docker/build-push-action/issues/461
4561 - name : Setup Docker buildx
46- uses : docker/setup-buildx-action@v3
62+ uses : docker/setup-buildx-action@v4
4763
4864 # Login against a Docker registry except on PR
4965 # https://github.com/docker/login-action
5066 - name : Log into registry ${{ env.REGISTRY }}
5167 if : github.event_name != 'pull_request'
52- uses : docker/login-action@v3
68+ uses : docker/login-action@v4
5369 with :
5470 registry : ${{ env.REGISTRY }}
5571 username : ${{ github.actor }}
@@ -59,12 +75,16 @@ jobs:
5975 # https://github.com/docker/metadata-action
6076 - name : Extract Docker metadata
6177 id : meta
62- uses : docker/metadata-action@v5
78+ uses : docker/metadata-action@v6
6379 with :
6480 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6581
6682 - name : Extract Docker Version Tag
67- id : docker_version_tag
83+ id : docker_version_tag
84+ env :
85+ # rebuild on code changes (push / manual run); only the nightly
86+ # schedule dedups on the version tag to skip identical rebuilds
87+ FORCE_REBUILD : ${{ github.event_name != 'schedule' && '1' || '' }}
6888 run : |
6989 ./get-version.sh $(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:" | tr '[:upper:]' '[:lower:]') | sed 's/^/tag=/g' >> $GITHUB_OUTPUT
7090
@@ -77,12 +97,12 @@ jobs:
7797 - name : Build and push Docker image with tag
7898 if : ${{ !endsWith(steps.docker_version_tag.outputs.tag, 'latest') }}
7999 id : build-and-push-tagged
80- uses : docker/build-push-action@v5
100+ uses : docker/build-push-action@v7
81101 with :
82102 context : .
83103 push : ${{ github.event_name != 'pull_request' }}
84104 tags : ${{ steps.docker_version_tag.outputs.tag }}
85- platforms : linux/amd64,linux/arm64,linux/arm/v7
105+ platforms : ${{ env.IMAGE_PLATFORMS }}
86106 labels : ${{ steps.meta.outputs.labels }}
87107 cache-from : type=gha
88108 cache-to : type=gha,mode=max
@@ -100,7 +120,7 @@ jobs:
100120
101121 - name : Build Docker Latest Tag
102122 if : ${{ !endsWith(steps.docker_version_tag.outputs.tag, 'latest') }}
103- id : docker_latest_tag
123+ id : docker_latest_tag
104124 run : |
105125 echo "tag=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
106126
@@ -109,12 +129,12 @@ jobs:
109129 - name : Build and push Docker image as latest
110130 if : ${{ !endsWith(steps.docker_version_tag.outputs.tag, 'latest') }}
111131 id : build-and-push-latest
112- uses : docker/build-push-action@v5
132+ uses : docker/build-push-action@v7
113133 with :
114134 context : .
115135 push : ${{ github.event_name != 'pull_request' }}
116136 tags : ${{ steps.docker_latest_tag.outputs.tag }}
117- platforms : linux/amd64,linux/arm64,linux/arm/v7
137+ platforms : ${{ env.IMAGE_PLATFORMS }}
118138 labels : ${{ steps.meta.outputs.labels }}
119139 cache-from : type=gha
120140 cache-to : type=gha,mode=max
0 commit comments