@@ -56,6 +56,10 @@ inputs:
56
56
description : " List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
57
57
required : false
58
58
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"
59
63
ssh :
60
64
description : " List of SSH agent socket or keys to expose to the build"
61
65
required : false
@@ -111,6 +115,7 @@ runs:
111
115
images : |
112
116
${{ inputs.registry }}/${{ steps.image_name.outputs.image_name }}
113
117
# 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
114
119
tags : |
115
120
type=sha
116
121
type=schedule
@@ -120,7 +125,7 @@ runs:
120
125
type=semver,pattern={{major}}.{{minor}}
121
126
type=semver,pattern={{major}}
122
127
type=raw,value=latest,enable={{is_default_branch}}
123
- type=sha,format=long
128
+ type=sha,format=long,priority=1001
124
129
${{ inputs.tags }}
125
130
labels : |
126
131
org.opencontainers.image.source=https://github.com/${{ inputs.organization }}/${{ inputs.repository }}
@@ -131,13 +136,18 @@ runs:
131
136
version : 1.6
132
137
force : ' true'
133
138
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)
134
144
- uses : edwardgeorge/jq-action@main
135
145
id : tag
136
146
with :
137
147
compact : true
138
148
raw-output : true
139
149
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] '
141
151
142
152
# docker context must be created prior to setting up Docker Buildx
143
153
# https://github.com/actions-runner-controller/actions-runner-controller/issues/893
@@ -148,10 +158,10 @@ runs:
148
158
docker context create buildx-context || true
149
159
150
160
- name : Set up QEMU
151
- uses : docker/setup-qemu-action@v2
161
+ uses : docker/setup-qemu-action@v3
152
162
153
163
- name : Set up Docker Buildx
154
- uses : docker/setup-buildx-action@v2
164
+ uses : docker/setup-buildx-action@v3
155
165
with :
156
166
endpoint : buildx-context
157
167
@@ -164,7 +174,7 @@ runs:
164
174
password : ${{ inputs.password }}
165
175
166
176
- name : Build and push Docker images
167
- uses : docker/build-push-action@v4
177
+ uses : docker/build-push-action@v5
168
178
id : docker-build-push-action
169
179
with :
170
180
context : ${{ inputs.workdir }}
@@ -175,6 +185,7 @@ runs:
175
185
build-args : ${{ inputs.build-args }}
176
186
cache-from : ${{ inputs.cache-from }}
177
187
cache-to : ${{ inputs.cache-to }}
188
+ no-cache : ${{ inputs.no-cache }}
178
189
tags : ${{ steps.meta.outputs.tags }}
179
190
target : ${{ inputs.target }}
180
191
labels : ${{ steps.meta.outputs.labels }}
0 commit comments