@@ -4,7 +4,7 @@ on: [push, pull_request]
44
55jobs :
66 test :
7- runs-on : ubuntu-22 .04
7+ runs-on : ubuntu-24 .04
88 env :
99 MIX_ENV : test
1010 steps :
@@ -13,11 +13,54 @@ jobs:
1313 - uses : erlef/setup-elixir@v1
1414 with :
1515 otp-version : 27.2
16- elixir-version : 1.17.3
16+ elixir-version : 1.18.1
1717
1818 - run : mix deps.get
1919 - run : mix deps.compile
2020 - run : mix compile --warnings-as-errors
2121 - run : mix test
2222 - run : mix format --check-formatted
2323 - run : mix deps.unlock --check-unused
24+
25+ docker :
26+ name : Docker
27+ runs-on : ubuntu-24.04
28+ permissions :
29+ contents : ' read'
30+ id-token : ' write'
31+ env :
32+ IMAGE_NAME : ' preview'
33+ PROJECT_ID : ' hexpm-prod'
34+ SERVICE_ACCOUNT : ${{ secrets.GCLOUD_SERVICE_ACCOUNT }}
35+ WORKLOAD_IDENTITY_PROVIDER : ${{ secrets.GCLOUD_WORKFLOW_IDENTITY_POOL_PROVIDER }}
36+ steps :
37+ - uses : actions/checkout@v4
38+ - name : Set short git commit SHA
39+ id : vars
40+ run : |
41+ calculatedSha=$(git rev-parse --short ${{ github.sha }})
42+ echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
43+ - name : Set up Docker Buildx
44+ uses : docker/setup-buildx-action@v3
45+ - name : Google auth
46+ id : auth
47+ uses : ' google-github-actions/auth@v2'
48+ with :
49+ token_format : ' access_token'
50+ project_id : ${{ env.PROJECT_ID }}
51+ service_account : ${{ env.SERVICE_ACCOUNT }}
52+ workload_identity_provider : ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
53+ - name : Docker Auth
54+ id : docker-auth
55+ uses : ' docker/login-action@v3'
56+ with :
57+ registry : gcr.io
58+ username : ' oauth2accesstoken'
59+ password : ' ${{ steps.auth.outputs.access_token }}'
60+ - name : Build and push
61+ uses : docker/build-push-action@v6
62+ with :
63+ tags : gcr.io/${{ env.PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHORT_SHA }}
64+ push : ${{ github.event_name != 'pull_request' }}
65+ cache-from : type=gha
66+ cache-to : type=gha,mode=max
0 commit comments