1818 - name : Install OTP and Elixir
1919 uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
2020 with :
21- otp-version : 27.2
21+ otp-version : 27.3.4.12
2222 elixir-version : 1.18.1
2323
2424 - name : Install dependencies
@@ -37,21 +37,13 @@ jobs:
3737 mix test.all
3838
3939 docker :
40- name : Docker (${{ matrix.platform }})
41- runs-on : ${{ matrix.runner }}
40+ name : Docker
41+ runs-on : ubuntu-24.04-arm
4242
4343 permissions :
4444 contents : " read"
4545 id-token : " write"
4646
47- strategy :
48- matrix :
49- include :
50- - platform : linux/amd64
51- runner : ubuntu-24.04
52- - platform : linux/arm64
53- runner : ubuntu-24.04-arm
54-
5547 env :
5648 IMAGE_NAME : " hexdocs"
5749 PROJECT_ID : " hexpm-prod"
6355 with :
6456 persist-credentials : false
6557
58+ - name : Set short git commit SHA
59+ run : echo "COMMIT_SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
60+
6661 - name : Set up Docker Buildx
6762 uses : docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
6863
@@ -85,74 +80,12 @@ jobs:
8580 username : " oauth2accesstoken"
8681 password : " ${{ steps.auth.outputs.access_token }}"
8782
88- - name : Build and push by digest
83+ - name : Build and push
8984 id : build
9085 uses : docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
9186 with :
92- platforms : ${{ matrix.platform }}
93- outputs : type=image,name=gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
94- cache-from : type=gha,scope=${{ matrix.runner }}
95- cache-to : type=gha,scope=${{ matrix.runner }},mode=max
96-
97- - name : Export digest
98- if : ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
99- run : |
100- mkdir -p /tmp/digests
101- digest="${DIGEST}"
102- touch "/tmp/digests/${digest#sha256:}"
103- env :
104- DIGEST : ${{ steps.build.outputs.digest }}
105-
106- - name : Upload digest
107- if : ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
108- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
109- with :
110- name : digests-${{ matrix.runner }}
111- path : /tmp/digests/*
112- if-no-files-found : error
113- retention-days : 1
114-
115- docker-merge :
116- name : Docker Merge
117- runs-on : ubuntu-24.04
118- if : ${{ github.event_name != 'pull_request' && github.repository == 'hexpm/hexdocs' }}
119- needs : docker
120- permissions :
121- contents : " read"
122- id-token : " write"
123- env :
124- IMAGE_NAME : " hexdocs"
125- PROJECT_ID : " hexpm-prod"
126- SERVICE_ACCOUNT : ${{ secrets.GCLOUD_SERVICE_ACCOUNT }}
127- WORKLOAD_IDENTITY_PROVIDER : ${{ secrets.GCLOUD_WORKFLOW_IDENTITY_POOL_PROVIDER }}
128- steps :
129- - name : Set short git commit SHA
130- run : echo "COMMIT_SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
131- - name : Download digests
132- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
133- with :
134- path : /tmp/digests
135- pattern : digests-*
136- merge-multiple : true
137- - name : Set up Docker Buildx
138- uses : docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
139- - name : Google auth
140- id : auth
141- uses : " google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093" # v3.0.0
142- with :
143- token_format : " access_token"
144- project_id : ${{ env.PROJECT_ID }}
145- service_account : ${{ env.SERVICE_ACCOUNT }}
146- workload_identity_provider : ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
147- - name : Docker Auth
148- uses : " docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee" # v4.2.0
149- with :
150- registry : gcr.io
151- username : " oauth2accesstoken"
152- password : " ${{ steps.auth.outputs.access_token }}"
153- - name : Create manifest list and push
154- working-directory : /tmp/digests
155- run : |
156- docker buildx imagetools create \
157- -t gcr.io/${PROJECT_ID}/${IMAGE_NAME}:${COMMIT_SHORT_SHA} \
158- $(printf "gcr.io/${PROJECT_ID}/${IMAGE_NAME}@sha256:%s " *)
87+ platforms : linux/arm64
88+ tags : gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHORT_SHA }}
89+ push : ${{ github.event_name != 'pull_request' && env.SERVICE_ACCOUNT != '' }}
90+ cache-from : type=gha
91+ cache-to : type=gha,mode=max
0 commit comments