66name : Create and publish a Docker image
77
88on :
9+ pull_request :
10+ branches : ["main"]
911 push :
10- branches :
11- - " !*"
1212 tags :
1313 - " v*"
1414
@@ -25,29 +25,41 @@ jobs:
2525
2626 steps :
2727 - name : Checkout repository
28- uses : actions/checkout@v3
28+ uses : actions/checkout@v4
2929
3030 - name : Set up QEMU
31- uses : docker/setup-qemu-action@v2
31+ uses : docker/setup-qemu-action@v3
3232
3333 - name : Set up Docker Buildx
34- uses : docker/setup-buildx-action@v2
34+ uses : docker/setup-buildx-action@v3
3535
3636 - name : Log in to the Container registry
37- uses : docker/login-action@v2
37+ uses : docker/login-action@v3
3838 with :
3939 registry : ${{ env.REGISTRY }}
4040 username : ${{ github.actor }}
4141 password : ${{ secrets.GITHUB_TOKEN }}
4242
4343 - name : Extract metadata (tags, labels) for Docker
4444 id : meta
45- uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
45+ uses : docker/metadata-action@v5
4646 with :
4747 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4848
49- - name : Build and push Docker image
50- uses : docker/build-push-action@v3
49+ - name : Build local docker image
50+ uses : docker/build-push-action@v5
51+ with :
52+ context : .
53+ push : false
54+ load : true
55+ platforms : linux/amd64
56+ tags : ${{ steps.meta.outputs.tags }}
57+ labels : ${{ steps.meta.outputs.labels }}
58+ file : docker/Dockerfile
59+
60+ - name : Build and push Docker image (on tagged version)
61+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
62+ uses : docker/build-push-action@v5
5163 with :
5264 context : .
5365 push : true
0 commit comments