@@ -223,27 +223,73 @@ jobs:
223223 INTEGRATION_TEST_NITRO_CONTRACTS_BRANCH=${{matrix.config.nitro-contracts-branch}} \
224224 pnpm test:integration
225225
226- test-integration-anvil :
227- name : Test (Integration Anvil)
226+ publish-nitro-contracts-image :
227+ name : Publish Nitro Contracts Image
228228 runs-on : ubuntu-latest
229- env :
230- NITRO_CONTRACTS_IMAGE_REF : v3.2.0-2f747c7
229+ permissions :
230+ contents : read
231+ packages : write
231232 steps :
232233 - name : Checkout
233234 uses : actions/checkout@v4
234235
236+ - name : Set nitro contracts image
237+ run : |
238+ echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts:v3.2.0-2f747c7" >> "$GITHUB_ENV"
239+
235240 - name : Set up Docker Buildx
236241 uses : docker/setup-buildx-action@v3
237242
238- - name : Build nitro contracts image
243+ - name : Log in to GHCR
244+ uses : docker/login-action@v3
245+ with :
246+ registry : ghcr.io
247+ username : ${{ github.actor }}
248+ password : ${{ secrets.GITHUB_TOKEN }}
249+
250+ - name : Check nitro contracts image
251+ id : check-image
252+ run : |
253+ if docker manifest inspect "${NITRO_CONTRACTS_GHCR_IMAGE}" >/dev/null 2>&1; then
254+ echo "exists=true" >> "$GITHUB_OUTPUT"
255+ else
256+ echo "exists=false" >> "$GITHUB_OUTPUT"
257+ fi
258+
259+ - name : Build and push nitro contracts image
260+ if : steps.check-image.outputs.exists != 'true'
239261 uses : docker/build-push-action@v6
240262 with :
241263 context : ./nitro-contracts
242264 file : ./nitro-contracts/Dockerfile
243- tags : chain-sdk-nitro-contracts:${{ env.NITRO_CONTRACTS_IMAGE_REF }}
244- load : true
245- cache-from : type=gha,scope=chain-sdk-nitro-contracts-${{ env.NITRO_CONTRACTS_IMAGE_REF }}
246- cache-to : type=gha,mode=max,scope=chain-sdk-nitro-contracts-${{ env.NITRO_CONTRACTS_IMAGE_REF }}
265+ push : true
266+ tags : |
267+ ${{ env.NITRO_CONTRACTS_GHCR_IMAGE }}
268+
269+ test-integration-anvil :
270+ name : Test (Integration Anvil)
271+ needs : publish-nitro-contracts-image
272+ runs-on : ubuntu-latest
273+ permissions :
274+ contents : read
275+ packages : read
276+ steps :
277+ - name : Checkout
278+ uses : actions/checkout@v4
279+
280+ - name : Set nitro contracts image
281+ run : |
282+ echo "NITRO_CONTRACTS_GHCR_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/chain-sdk-nitro-contracts:v3.2.0-2f747c7" >> "$GITHUB_ENV"
283+
284+ - name : Log in to GHCR
285+ uses : docker/login-action@v3
286+ with :
287+ registry : ghcr.io
288+ username : ${{ github.actor }}
289+ password : ${{ secrets.GITHUB_TOKEN }}
290+
291+ - name : Load nitro contracts image
292+ run : docker pull "${NITRO_CONTRACTS_GHCR_IMAGE}"
247293
248294 - name : Setup pnpm
249295 uses : pnpm/action-setup@v4
@@ -285,3 +331,5 @@ jobs:
285331 with :
286332 path : .cache/anvil-rpc-cache.json
287333 key : ${{ runner.os }}-anvil-rpc-cache-${{ github.ref_name }}-${{ github.run_id }}
334+
335+
0 commit comments