@@ -56,6 +56,10 @@ inputs:
5656 description : " List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
5757 required : false
5858 default : type=gha,mode=max
59+ no-cache :
60+ description : " Send the --no-cache flag to the docker build process"
61+ required : false
62+ default : " false"
5963 ssh :
6064 description : " List of SSH agent socket or keys to expose to the build"
6165 required : false
@@ -111,6 +115,7 @@ runs:
111115 images : |
112116 ${{ inputs.registry }}/${{ steps.image_name.outputs.image_name }}
113117 # generate Docker tags based on the following events/attributes
118+ # we set sha as higher priority than the defaults, so that it is the first tag
114119 tags : |
115120 type=sha
116121 type=schedule
@@ -120,7 +125,7 @@ runs:
120125 type=semver,pattern={{major}}.{{minor}}
121126 type=semver,pattern={{major}}
122127 type=raw,value=latest,enable={{is_default_branch}}
123- type=sha,format=long
128+ type=sha,format=long,priority=1001
124129 ${{ inputs.tags }}
125130 labels : |
126131 org.opencontainers.image.source=https://github.com/${{ inputs.organization }}/${{ inputs.repository }}
@@ -131,13 +136,18 @@ runs:
131136 version : 1.6
132137 force : ' true'
133138
139+ # here we set the first tag in the output as the output of this step
140+ # this order is determined by the priority, we set the sha as 1001, as that is 1 above the defaults
141+ # If a custom tag is added we can add a priority higher than that to set that as the output.
142+ # https://github.com/docker/metadata-action#priority-attribute
143+ # this formula is, of the tags, grab the first (highest priority), then split by : for the tag, grab the tag (last element)
134144 - uses : edwardgeorge/jq-action@main
135145 id : tag
136146 with :
137147 compact : true
138148 raw-output : true
139149 input : ${{ steps.meta.outputs.json }}
140- script : ' .tags | map(select(test("sha-\\w{8,}"))) | first | match("sha-\\w{8,} ") | .string '
150+ script : ' .tags | ( first / ": ") | .[length -1] '
141151
142152 # docker context must be created prior to setting up Docker Buildx
143153 # https://github.com/actions-runner-controller/actions-runner-controller/issues/893
@@ -148,10 +158,10 @@ runs:
148158 docker context create buildx-context || true
149159
150160 - name : Set up QEMU
151- uses : docker/setup-qemu-action@v2
161+ uses : docker/setup-qemu-action@v3
152162
153163 - name : Set up Docker Buildx
154- uses : docker/setup-buildx-action@v2
164+ uses : docker/setup-buildx-action@v3
155165 with :
156166 endpoint : buildx-context
157167
@@ -164,7 +174,7 @@ runs:
164174 password : ${{ inputs.password }}
165175
166176 - name : Build and push Docker images
167- uses : docker/build-push-action@v4
177+ uses : docker/build-push-action@v5
168178 id : docker-build-push-action
169179 with :
170180 context : ${{ inputs.workdir }}
@@ -175,6 +185,7 @@ runs:
175185 build-args : ${{ inputs.build-args }}
176186 cache-from : ${{ inputs.cache-from }}
177187 cache-to : ${{ inputs.cache-to }}
188+ no-cache : ${{ inputs.no-cache }}
178189 tags : ${{ steps.meta.outputs.tags }}
179190 target : ${{ inputs.target }}
180191 labels : ${{ steps.meta.outputs.labels }}
0 commit comments