2121 version :
2222 type : string
2323 description : ' Docker image version.'
24- required : true
24+ required : false
2525
2626
2727# Use bash shell with verbose output
@@ -31,13 +31,16 @@ defaults:
3131
3232# Add write permissions to the ghcr.io docker repository
3333permissions :
34+ contents : read
3435 packages : write
3536
3637jobs :
3738
3839 build :
3940 name : Build ${{ matrix.platform }}
40- runs-on : ubuntu-latest
41+ permissions :
42+ contents : read
43+ packages : write
4144 strategy :
4245 fail-fast : false
4346 matrix :
4649 runner : matterlabs-ci-runner-high-performance
4750 - platform : arm64
4851 runner : matterlabs-ci-runner-arm
52+ runs-on : ${{ matrix.runner }}
4953 steps :
5054 - name : Checkout
5155 uses : actions/checkout@v4
6367 username : ${{ github.repository_owner }}
6468 password : ${{ github.token }}
6569
70+ - name : Download setup key
71+ shell : bash
72+ run : |
73+ if [ -f "/setup_2^26.key" ]; then
74+ cp '/setup_2^26.key' './setup_2^26.key'
75+ else
76+ curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
77+ fi
78+
79+ # Download prebuilt contracts version if exists, otherwise build them
80+ - name : Build contracts
81+ uses : matter-labs/zksync-ci-common/.github/actions/build-contracts@aba-ci-optimize
82+
6683 - name : Docker meta
6784 id : meta
6885 uses : docker/metadata-action@v5
7289 matterlabs/${{ inputs.image }}
7390
7491 - name : Define whether to save cache
75- # if: github.event_name != 'pull_request'
92+ # if: github.event_name != 'pull_request' # TODO: uncomment before merging to main
7693 id : set-cache-to
7794 run : echo "cache-to=type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}:buildcache-${{ matrix.platform }},mode=max" >> "${GITHUB_OUTPUT}"
7895
89106 labels : ${{ steps.meta.outputs.labels }}
90107 cache-from : ' type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}:buildcache-${{ matrix.platform }}'
91108 cache-to : ${{ steps.set-cache-to.outputs.cache-to }}
92- outputs : type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ inputs.image }},matterlabs/${{ inputs.image }}",push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
109+ outputs : type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}",push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
110+ # outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ inputs.image }},matterlabs/${{ inputs.image }}",push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
93111
94112 - name : Export digest
95113 run : |
@@ -105,51 +123,51 @@ jobs:
105123 if-no-files-found : error
106124 retention-days : 1
107125
108- merge :
109- runs-on : matterlabs-ci-runner-high-performance
110- needs : build
111- steps :
112- - name : Download digests
113- uses : actions/download-artifact@v4
114- with :
115- path : ${{ runner.temp }}/digests
116- pattern : digests-*
117- merge-multiple : true
118-
119- - name : Log in to Docker Hub
120- uses : docker/login-action@v3
121- with :
122- username : ${{ secrets.dockerhub_user }}
123- password : ${{ secrets.dockerhub_token }}
124-
125- - name : Login to GHCR
126- uses : docker/login-action@v3
127- with :
128- registry : ghcr.io
129- username : ${{ github.repository_owner }}
130- password : ${{ github.token }}
131-
132- - name : Set up Docker Buildx
133- uses : docker/setup-buildx-action@v3
134-
135- - name : Docker meta
136- id : meta
137- uses : docker/metadata-action@v5
138- with :
139- images : |
140- ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
141- matterlabs/${{ inputs.image }}
142-
143- - name : Create manifest list and push
144- working-directory : ${{ runner.temp }}/digests
145- shell : bash -ex {0}
146- run : |
147- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
148- $(printf 'ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}@sha256:%s ' *)
149- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
150- $(printf 'matterlabs/${{ inputs.image }}@sha256:%s ' *)
151-
152- - name : Inspect image
153- run : |
154- docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}:${{ inputs.version }}
155- docker buildx imagetools inspect matterlabs/${{ inputs.image }}:${{ inputs.version }}
126+ merge :
127+ runs-on : ubuntu-latest
128+ needs : build
129+ steps :
130+ - name : Download digests
131+ uses : actions/download-artifact@v4
132+ with :
133+ path : ${{ runner.temp }}/digests
134+ pattern : digests-*
135+ merge-multiple : true
136+
137+ - name : Log in to Docker Hub
138+ uses : docker/login-action@v3
139+ with :
140+ username : ${{ secrets.dockerhub_user }}
141+ password : ${{ secrets.dockerhub_token }}
142+
143+ - name : Login to GHCR
144+ uses : docker/login-action@v3
145+ with :
146+ registry : ghcr.io
147+ username : ${{ github.repository_owner }}
148+ password : ${{ github.token }}
149+
150+ - name : Set up Docker Buildx
151+ uses : docker/setup-buildx-action@v3
152+
153+ - name : Docker meta
154+ id : meta
155+ uses : docker/metadata-action@v5
156+ with :
157+ images : |
158+ ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
159+ # matterlabs/${{ inputs.image }}
160+
161+ - name : Create manifest list and push
162+ working-directory : ${{ runner.temp }}/digests
163+ shell : bash -ex {0}
164+ run : |
165+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
166+ $(printf 'ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}@sha256:%s ' *)
167+ # docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
168+ # $(printf 'matterlabs/${{ inputs.image }}@sha256:%s ' *)
169+
170+ # - name: Inspect image
171+ # run: |
172+ # docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}:${{ inputs.version }}
173+ # docker buildx imagetools inspect matterlabs/${{ inputs.image }}:${{ inputs.version }}
0 commit comments