File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Reusable Workflow For Build-Push to Google Artifact Registry
2+ on :
3+ workflow_call :
4+ inputs :
5+ gar-region :
6+ type : string
7+ default : " asia-northeast3"
8+ gar-project-id :
9+ required : true
10+ type : string
11+ gar-repository :
12+ required : true
13+ type : string
14+ service-name :
15+ required : true
16+ type : string
17+ image-tag :
18+ required : true
19+ type : string
20+ workload-identity-provider :
21+ required : true
22+ type : string
23+ service-account :
24+ required : true
25+ type : string
26+ target :
27+ required : false
28+ type : string
29+
30+ permissions :
31+ contents : read
32+ id-token : write
33+
34+ jobs :
35+ build-push :
36+ runs-on : ubuntu-latest
37+ steps :
38+ - uses : actions/checkout@v4
39+
40+ - name : Authenticate to Google Cloud
41+ id : auth
42+ uses : google-github-actions/auth@v3
43+ with :
44+ workload_identity_provider : ${{ inputs.workload-identity-provider }}
45+ service_account : ${{ inputs.service-account }}
46+ token_format : " access_token"
47+
48+ - name : Set up Docker Buildx
49+ uses : docker/setup-buildx-action@v2
50+
51+ - name : Log in to Google Artifact Registry
52+ uses : docker/login-action@v3
53+ with :
54+ registry : ${{ inputs.gar-region }}-docker.pkg.dev
55+ username : oauth2accesstoken
56+ password : ${{ steps.auth.outputs.access_token }}
57+
58+ - name : Build and push
59+ uses : docker/build-push-action@v3
60+ with :
61+ context : .
62+ push : true
63+ tags : ${{ inputs.gar-region }}-docker.pkg.dev/${{ inputs.gar-project-id }}/${{ inputs.gar-repository }}/${{ inputs.service-name }}:${{ inputs.image-tag }}
64+ target : ${{ inputs.target || '' }}
65+ cache-from : type=gha
66+ cache-to : type=gha,mode=max
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1313 RELEASE_TAG : ${{ steps.release-tag.outputs.RELEASE_TAG }}
1414
1515 steps :
16- - uses : actions/checkout@v3
16+ - uses : actions/checkout@v4
1717 - id : release-tag
1818 run : echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
Original file line number Diff line number Diff line change 1313 IMAGE_TAG : ${{ steps.IMAGE_TAG.outputs.IMAGE_TAG }}
1414
1515 steps :
16- - uses : actions/checkout@v3
17- - uses : benjlevesque/short-sha@v1 .2
16+ - uses : actions/checkout@v4
17+ - uses : benjlevesque/short-sha@v2 .2
1818 id : short-sha
1919 - id : IMAGE_TAG
2020 run : echo "IMAGE_TAG=staging-${{ steps.short-sha.outputs.sha }}" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments