52
52
env :
53
53
PROJECT_ID : YOUR_PROJECT_ID # TODO: update Google Cloud project id
54
54
GAR_LOCATION : YOUR_GAR_LOCATION # TODO: update Artifact Registry location
55
+ REPOSITORY : YOUR_REPOSITORY_NAME # TODO: update Artifact Registry repository name
55
56
SERVICE : YOUR_SERVICE_NAME # TODO: update Cloud Run service name
56
57
REGION : YOUR_SERVICE_REGION # TODO: update Cloud Run service region
57
58
80
81
# id: auth
81
82
# uses: 'google-github-actions/auth@v0'
82
83
# with:
83
- # credentials_json: '${{ secrets.GCP_CREDENTIALS }}''
84
+ # credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
84
85
85
86
# BEGIN - Docker auth and build (NOTE: If you already have a container image, these Docker steps can be omitted)
86
87
@@ -92,11 +93,20 @@ jobs:
92
93
username : ' oauth2accesstoken'
93
94
password : ' ${{ steps.auth.outputs.access_token }}'
94
95
registry : ' ${{ env.GAR_LOCATION }}-docker.pkg.dev'
96
+
97
+ # NOTE: Alternative option - authentication via credentials json
98
+ # - name: Docker Auth
99
+ # id: docker-auth
100
+ # uses: 'docker/login-action@v1'
101
+ # with:
102
+ # registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
103
+ # username: _json_key
104
+ # password: ${{ secrets.GCP_CREDENTIALS }}
95
105
96
106
- name : Build and Push Container
97
107
run : |-
98
- docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}" ./
99
- docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}"
108
+ docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env. SERVICE }}:${{ github.sha }}" ./
109
+ docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env. SERVICE }}:${{ github.sha }}"
100
110
101
111
# END - Docker auth and build
102
112
@@ -107,7 +117,11 @@ jobs:
107
117
service : ${{ env.SERVICE }}
108
118
region : ${{ env.REGION }}
109
119
# NOTE: If using a pre-built image, update the image name here
110
- image : ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
120
+ image : ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
121
+ # NOTE: You can also set env variables here:
122
+ # env_vars: |
123
+ # NODE_ENV=production
124
+ # TOKEN_EXPIRE=6400
111
125
112
126
# If required, use the Cloud Run url output in later steps
113
127
- name : Show Output
0 commit comments