1+ # SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
2+ # SPDX-License-Identifier: MIT
13# Inspired by https://github.com/sredevopsorg/multi-arch-docker-github-workflow
24name : Docker Image CI
35
@@ -30,26 +32,20 @@ jobs:
3032
3133 steps :
3234 - name : Checkout code
33- uses : actions/checkout@v6
35+ uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
3436 with :
3537 repository : ${{ inputs.upstream_tag && 'nextcloud/notify_push' || github.repository }}
3638 ref : ${{ inputs.upstream_tag || github.ref_name }}
3739
3840 - name : Log in to GitHub Packages
39- uses : docker/login-action@v4
41+ uses : docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
4042 with :
4143 registry : ghcr.io
4244 username : ${{ github.actor }}
4345 password : ${{ secrets.GITHUB_TOKEN }}
4446
4547 - name : Set up Docker Buildx
46- uses : docker/setup-buildx-action@v4
47-
48- - name : Lower case docker image name
49- id : image
50- uses : ASzc/change-string-case-action@v8
51- with :
52- string : ${{ github.repository }}
48+ uses : docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
5349
5450 - name : Sanitize upstream tag
5551 if : inputs.upstream_tag != ''
6056
6157 - name : Extract metadata
6258 id : meta
63- uses : docker/metadata-action@v6
59+ uses : docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
6460 with :
6561 images : ghcr.io/${{ github.repository }}
6662 tags : |
@@ -70,12 +66,12 @@ jobs:
7066
7167 - name : Build and push by digest
7268 id : build
73- uses : docker/build-push-action@v7
69+ uses : docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
7470 with :
7571 context : .
7672 platforms : ${{ matrix.platform }}
7773 labels : ${{ steps.meta.outputs.labels }}
78- outputs : type=image,name=ghcr.io/${{ steps.image.outputs.lowercase }},push-by-digest=true,name-canonical=true,push=true
74+ outputs : type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
7975 cache-from : type=gha,scope=${{ matrix.platform }}
8076 cache-to : type=gha,mode=max,scope=${{ matrix.platform }}
8177
8783 DIGEST : ${{ steps.build.outputs.digest }}
8884
8985 - name : Upload digest
90- uses : actions/upload-artifact@v7
86+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
9187 with :
9288 name : digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
9389 path : /tmp/digests/*
@@ -104,27 +100,21 @@ jobs:
104100
105101 steps :
106102 - name : Download digests
107- uses : actions/download-artifact@v8
103+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
108104 with :
109105 path : /tmp/digests
110106 pattern : digests-*
111107 merge-multiple : true
112108
113109 - name : Log in to GitHub Packages
114- uses : docker/login-action@v4
110+ uses : docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
115111 with :
116112 registry : ghcr.io
117113 username : ${{ github.actor }}
118114 password : ${{ secrets.GITHUB_TOKEN }}
119115
120116 - name : Set up Docker Buildx
121- uses : docker/setup-buildx-action@v4
122-
123- - name : Lower case docker image name
124- id : image
125- uses : ASzc/change-string-case-action@v8
126- with :
127- string : ${{ github.repository }}
117+ uses : docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
128118
129119 - name : Sanitize upstream tag
130120 if : inputs.upstream_tag != ''
@@ -135,7 +125,7 @@ jobs:
135125
136126 - name : Extract metadata
137127 id : meta
138- uses : docker/metadata-action@v6
128+ uses : docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
139129 with :
140130 images : ghcr.io/${{ github.repository }}
141131 tags : |
@@ -158,16 +148,16 @@ jobs:
158148 --annotation='index:org.opencontainers.image.created=${{ steps.timestamp.outputs.timestamp }}' \
159149 --annotation='index:org.opencontainers.image.url=${{ github.event.repository.url }}' \
160150 --annotation='index:org.opencontainers.image.source=${{ github.event.repository.url }}' \
161- $(printf 'ghcr.io/${{ steps.image.outputs.lowercase }}@sha256:%s ' *)
151+ $(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
162152
163153 - name : Create and push manifest (without annotations)
164154 if : steps.manifest.outcome == 'failure'
165155 working-directory : /tmp/digests
166156 run : |
167157 docker buildx imagetools create \
168158 $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
169- $(printf 'ghcr.io/${{ steps.image.outputs.lowercase }}@sha256:%s ' *)
159+ $(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
170160
171161 - name : Inspect manifest
172162 run : |
173- docker buildx imagetools inspect 'ghcr.io/${{ steps.image.outputs.lowercase }}:${{ steps.meta.outputs.version }}'
163+ docker buildx imagetools inspect 'ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}'
0 commit comments