@@ -27,28 +27,35 @@ jobs:
2727 - name : Set up Docker Buildx
2828 uses : docker/setup-buildx-action@v3
2929
30+ - name : Log in to GitHub Docker Registry
31+ if : github.event_name != 'pull_request'
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ghcr.io
35+ username : ${{ github.actor }}
36+ password : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Extract metadata for publishing image
39+ id : meta
40+ uses : docker/metadata-action@v5
41+ with :
42+ images : ghcr.io/${{ github.repository }}
43+
3044 - name : Build and export to Docker local cache
3145 uses : docker/build-push-action@v6
3246 with :
33- platforms : linux/${{ matrix.arch }}
3447 # Need load and tags so we can test it below
3548 load : true
3649 tags : tag_for_testing
3750
3851 - name : Test cli works in cached runtime image
3952 run : docker run --rm tag_for_testing uvx pycowsay 'hello ubuntu-devcontainer!'
4053
41- - name : Create tags for publishing image
42- id : meta
43- uses : docker/metadata-action@v5
44- with :
45- images : ghcr.io/${{ github.repository }}
46-
4754 - name : Build and push by digest
4855 id : build
56+ # if: github.ref_type == 'tag'
4957 uses : docker/build-push-action@v6
5058 with :
51- platforms : linux/${{ matrix.arch }}
5259 labels : ${{ steps.meta.outputs.labels }}
5360 outputs : type=image,push-by-digest=true,name-canonical=true,push=true
5461
0 commit comments