66 - ' *'
77 workflow_dispatch :
88
9+ env :
10+ DOCKER_METADATA_SET_OUTPUT_ENV : ' true'
11+
912jobs :
10- verify :
13+ retag :
1114 runs-on : ubuntu-latest
12- outputs :
13- base_image : ${{ steps.get-base-image.outputs.tags }}
1415 steps :
1516 - name : Checkout code
1617 uses : actions/checkout@v4
1718
19+ - name : Set up QEMU
20+ uses : docker/setup-qemu-action@v3
21+
22+ - name : Set up Docker Buildx
23+ uses : docker/setup-buildx-action@v3
24+
1825 - name : Login to GitHub Container Registry
1926 uses : docker/login-action@v3
2027 with :
@@ -30,33 +37,13 @@ jobs:
3037 tags : type=sha
3138
3239 - name : Verify that the image was previously built
33- run : docker pull "$BASE_IMAGE"
3440 env :
3541 BASE_IMAGE : ${{ steps.get-base-image.outputs.tags }}
36-
37- retag :
38- runs-on : ubuntu-latest
39- needs :
40- - verify
41- steps :
42- - name : Checkout code
43- uses : actions/checkout@v4
44-
45- - name : Set up QEMU
46- uses : docker/setup-qemu-action@v3
47-
48- - name : Set up Docker Buildx
49- uses : docker/setup-buildx-action@v3
50-
51- - name : Login to GitHub Container Registry
52- uses : docker/login-action@v3
53- with :
54- registry : ghcr.io
55- username : ${{ github.actor }}
56- password : ${{ secrets.GITHUB_TOKEN }}
42+ run : |
43+ docker pull "$BASE_IMAGE"
5744
5845 - name : Produce release tags
59- id : meta
46+ id : tag- meta
6047 uses : docker/metadata-action@v5
6148 with :
6249 images : ghcr.io/${{ github.repository }}
6754 type=semver,pattern={{major}}.{{minor}}
6855 type=semver,pattern={{version}}
6956
70- - name : Retag and push the image
71- uses : docker/build-push-action@v6
72- with :
73- cache-from : type=registry,ref=${{ needs.verify.outputs.base_image }}
74- labels : ${{ steps.meta.outputs.labels }}
75- platforms : linux/amd64,linux/arm64
76- push : true
77- tags : ${{ steps.meta.outputs.tags }}
57+ - name : Retag the pulled image
58+ env :
59+ BASE_IMAGE : ${{ steps.get-base-image.outputs.tags }}
60+ run : |
61+ echo "$DOCKER_METADATA_OUTPUT_TAGS" | tr ' ' '\n' | xargs -n1 docker tag "$BASE_IMAGE"
62+ docker push --all-tags "$(echo "$BASE_IMAGE" | cut -f1 -d:)"
0 commit comments