5353 env :
5454 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5555
56-
5756 build :
5857 runs-on : ubuntu-latest
5958 needs : metadata
7574 python_variant :
7675 - " "
7776 - " -slim"
78- platform :
79- - linux/amd64
80- - linux/arm64
77+ platform : ${{ fromJSON(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && '["linux/arm64","linux/amd64"]' || '["linux/amd64"]') }}
8178 steps :
8279 - name : Checkout (Latest Release)
8380 if : github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
@@ -116,6 +113,10 @@ jobs:
116113 id : metadata
117114 with :
118115 images : ${{ steps.image.outputs.IMAGE }}
116+ tags : |
117+ type=edge,value=nightly
118+ type=ref,event=pr
119+ type=sha,event=branch
119120
120121 - name : Build and Publish
121122 uses : docker/build-push-action@v6
@@ -199,23 +200,36 @@ jobs:
199200 run : |
200201 echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
201202
202- - name : Generate Tags
203+ - name : Generate Tags (Release)
203204 uses : docker/metadata-action@v5
204- id : metadata
205+ if : github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
206+ id : metadata-release
205207 with :
206208 context : git
207209 images : |
208210 ${{ steps.image.outputs.IMAGE }}
209211 flavor : |
210212 suffix=-py${{ matrix.python_version }}${{ matrix.python_variant }},onlatest=true
211213 tags : |
212- type=edge,value=nightly
213- type=ref,event=pr
214- type=sha,event=branch
215214 type=semver,pattern={{version}}
216215 type=semver,pattern={{major}}.{{minor}}
217216 type=semver,pattern={{major}}
218217
218+ - name : Generate Labels (Other)
219+ if : github.event_name != 'workflow_run'
220+ uses : docker/metadata-action@v5
221+ id : metadata-other
222+ with :
223+ context : git
224+ images : |
225+ ${{ steps.image.outputs.IMAGE }}
226+ flavor : |
227+ suffix=-py${{ matrix.python_version }}${{ matrix.python_variant }},onlatest=true
228+ tags : |
229+ type=edge,value=nightly
230+ type=ref,event=pr
231+ type=sha,event=branch
232+
219233 - name : Create manifest list and push
220234 working-directory : /tmp/digests
221235 run : |
@@ -224,10 +238,10 @@ jobs:
224238 docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
225239 $(printf '${{ steps.image.outputs.IMAGE }}@sha256:%s ' *)
226240
227- - name : Generate Tags
241+ - name : Generate Tags (Release)
228242 uses : docker/metadata-action@v5
229- id : metadata-latest
230- if : matrix.python_version == env.LATEST_PYTHON_VERSION
243+ id : metadata-latest-release
244+ if : matrix.python_version == env.LATEST_PYTHON_VERSION && github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
231245 with :
232246 context : git
233247 images : |
@@ -238,7 +252,19 @@ jobs:
238252 type=semver,pattern={{version}}
239253 type=semver,pattern={{major}}.{{minor}}
240254 type=semver,pattern={{major}}
241-
255+ - name : Generate Labels (Other)
256+ if : matrix.python_version == env.LATEST_PYTHON_VERSION && github.event_name != 'workflow_run'
257+ uses : docker/metadata-action@v5
258+ id : metadata-latest-other
259+ with :
260+ context : git
261+ images : |
262+ ${{ steps.image.outputs.IMAGE }}
263+ flavor : |
264+ suffix=${{ matrix.python_variant }},onlatest=true
265+ tags : |
266+ type=ref,event=pr
267+ type=sha,event=branch
242268 - name : Create manifest list and push for latest python version
243269 if : matrix.python_version == env.LATEST_PYTHON_VERSION
244270 working-directory : /tmp/digests
0 commit comments