@@ -84,14 +84,37 @@ jobs:
8484 run : go-licenses check . --allowed_licenses=Apache-2.0,MIT,BSD-3-Clause,BSD-2-Clause --ignore modernc.org/mathutil
8585
8686 build-image :
87+ if : github.event_name == 'pull_request'
88+ runs-on : ubuntu-latest
89+ steps :
90+ - name : Checkout
91+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
92+
93+ - name : Set up Docker Buildx
94+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
95+
96+ - name : Build image
97+ uses : docker/build-push-action@ee4ca427a2f43b6a16632044ca514c076267da23 # v6.19.0
98+ with :
99+ context : .
100+ platforms : linux/amd64,linux/arm64
101+ push : false
102+ sbom : false
103+ build-args : |
104+ GIT_TAG=pr
105+ GIT_COMMIT=dev
106+ cache-from : type=gha,scope=buildx
107+ cache-to : type=gha,mode=max,scope=buildx
108+
109+ build-and-push-image :
110+ if : github.event_name != 'pull_request'
87111 needs : [lint, build-and-test, license-check]
88112 runs-on : ubuntu-latest
89113 steps :
90114 - name : Checkout
91115 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
92116
93117 - name : Hub login
94- if : github.event_name != 'pull_request'
95118 uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
96119 with :
97120 username : ${{ vars.DOCKERPUBLICBOT_USERNAME }}
@@ -116,13 +139,13 @@ jobs:
116139 with :
117140 context : .
118141 platforms : linux/amd64,linux/arm64
119- push : ${{ github.event_name != 'pull_request' }}
142+ push : true
120143 sbom : true
121144 provenance : mode=max
122145 tags : ${{ steps.meta.outputs.tags }}
123146 labels : ${{ steps.meta.outputs.labels }}
124147 build-args : |
125- GIT_TAG=${{ github.event_name == 'pull_request' && 'pr' || github. ref_name }}
126- GIT_COMMIT=${{ github.event_name == 'pull_request' && 'dev' || github. sha }}
148+ GIT_TAG=${{ github.ref_name }}
149+ GIT_COMMIT=${{ github.sha }}
127150 cache-from : type=gha,scope=buildx
128151 cache-to : type=gha,mode=max,scope=buildx
0 commit comments