8787 platforms : linux/amd64,linux/arm64
8888
8989 - name : Login to GHCR
90+ if : github.event_name != 'pull_request'
9091 uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
9192 with :
9293 registry : ghcr.io
@@ -117,7 +118,24 @@ jobs:
117118 type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }}
118119 type=sha,format=long,prefix=,priority=1000
119120
121+ - name : Build image (pull request)
122+ if : github.event_name == 'pull_request'
123+ id : build-pr
124+ uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
125+ with :
126+ context : .
127+ file : cmd/fluent-manager/Dockerfile
128+ platforms : ${{ matrix.platform }}
129+ labels : ${{ steps.image-metadata.outputs.labels }}
130+ provenance : false
131+ cache-from : type=gha
132+ cache-to : type=gha,mode=max
133+ build-args : |
134+ GO_VERSION=${{ steps.setup-go.outputs.go-version }}
135+ push : false
136+
120137 - name : Build and push image
138+ if : github.event_name != 'pull_request'
121139 id : build
122140 uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
123141 with :
@@ -130,10 +148,10 @@ jobs:
130148 cache-to : type=gha,mode=max
131149 build-args : |
132150 GO_VERSION=${{ steps.setup-go.outputs.go-version }}
133- push : ${{ github.event_name != 'pull_request' }}
134- outputs : ${{ github.event_name != 'pull_request' && format('type=image,"name={0},{1}",push-by-digest=true,name-canonical=true,push=true', env.GHCR_REPO, env.DOCKERHUB_REPO) || '' }}
151+ outputs : type=image,"name=${{ env.GHCR_REPO }},${{ env.DOCKERHUB_REPO }}",push-by-digest=true,name-canonical=true,push=true
135152
136153 - name : Output image digests
154+ if : github.event_name != 'pull_request'
137155 id : output-digests
138156 run : |
139157 platform="${{ matrix.platform }}"
@@ -155,7 +173,6 @@ jobs:
155173 password : ${{ secrets.GITHUB_TOKEN }}
156174
157175 - name : Login to Docker Hub
158- if : github.event_name != 'pull_request'
159176 uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
160177 with :
161178 registry : docker.io
0 commit comments