99 uses : actions/checkout@v4
1010 with :
1111 persist-credentials : false
12-
1312
14-
1513 - name : Generate Metadata
1614 id : meta
17- uses : docker/metadata-action@v5
15+ uses : docker/metadata-action@v5
1816 with :
1917 images : ghcr.io/${{ github.repository }}
20-
21- # - name: Build image
22- # uses: docker/build-push-actions@v6
23-
18+ tags : |
19+ type=raw,value=latest
20+ type=semver,pattern={{version}}
21+ type=semver,pattern={{major}}.{{minor}}
22+ type=semver,pattern={{major}}
23+
24+ - name : Build and export to Docker local cache
25+ uses : docker/build-push-action@v6
26+ env :
27+ DOCKER_BUILD_RECORD_UPLOAD : false
28+ with :
29+ # Need load and tags so we can test it below
30+ load : true
31+ tags : test_tag
32+
33+ - name : Test cli works in cached runtime image
34+ run : docker run --rm test_tag --version
35+
2436 - name : Log in to GHCR
25- # if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
2637 uses : docker/login-action@v3
2738 with :
2839 registry : ghcr.io/${{ github.repository_owner }}
2940 username : ${{ github.actor }}
3041 password : ${{ secrets.GITHUB_TOKEN }}
3142
32- - name : Publish image
43+ # This does not build the image again, it will find the image in the
44+ # Docker cache and publish it
45+ - name : Push cached image to container registry
3346 uses : docker/build-push-action@v6
3447 env :
3548 DOCKER_BUILD_RECORD_UPLOAD : false
3649 with :
37- # push: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
38- push : true
39- tags : ${{ steps.meta.outputs.tags }}
50+ push : ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
51+ tags : ${{ steps.meta.outputs.tags }}
52+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments