@@ -46,21 +46,27 @@ Cloud Run service. See the [Credentials](#credentials) below for more informatio
46
46
## Usage
47
47
48
48
``` yaml
49
- - id : auth
50
- uses :
google-github-actions/[email protected]
51
- with :
52
- workload_identity_provider : ' projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
53
- service_account :
' [email protected] '
54
-
55
- - name : Deploy to Cloud Run
56
- id : deploy
57
- uses :
google-github-actions/[email protected]
58
- with :
59
- service : hello-cloud-run
60
- image : gcr.io/cloudrun/hello
61
-
62
- - name : Use Output
63
- run : curl "${{ steps.deploy.outputs.url }}"
49
+ jobs :
50
+ job_id :
51
+ permissions :
52
+ contents : ' read'
53
+ id-token : ' write'
54
+
55
+ steps :
56
+ - id : ' auth'
57
+ uses : ' google-github-actions/auth@v0'
58
+ with :
59
+ workload_identity_provider : ' projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
60
+ service_account :
' [email protected] '
61
+
62
+ - id : ' deploy'
63
+ uses :
' google-github-actions/[email protected] '
64
+ with :
65
+ service : ' hello-cloud-run'
66
+ image : ' gcr.io/cloudrun/hello'
67
+
68
+ - name : ' Use output'
69
+ run : ' curl "${{ steps.deploy.outputs.url }}"'
64
70
` ` `
65
71
66
72
## Inputs
@@ -149,32 +155,42 @@ one of the methods found in [Configuring Ownership and access to a service accou
149
155
# ### Authenticating via Workload Identity Federation
150
156
151
157
` ` ` yaml
152
- - id: 'auth'
153
- uses: 'google-github-actions/[email protected] '
154
- with:
155
- workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
156
- service_account: '[email protected] '
157
-
158
- - name: Deploy to Cloud Run
159
- uses: google-github-actions/[email protected]
160
- with:
161
- image: gcr.io/cloudrun/hello
162
- service: hello-cloud-run
158
+ jobs:
159
+ job_id:
160
+ permissions:
161
+ contents: 'read'
162
+ id-token: 'write'
163
+
164
+ steps:
165
+ - id: 'auth'
166
+ uses: 'google-github-actions/auth@v0'
167
+ with:
168
+ workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
169
+ service_account: '[email protected] '
170
+
171
+ - name: 'Deploy to Cloud Run'
172
+ uses: 'google-github-actions/[email protected] '
173
+ with:
174
+ image: 'gcr.io/cloudrun/hello'
175
+ service: 'hello-cloud-run'
163
176
` ` `
164
177
165
178
# ### Authenticating via Service Account Key JSON
166
179
167
180
` ` ` yaml
168
- - id: 'auth'
169
- uses: 'google-github-actions/[email protected] '
170
- with:
171
- credentials_json: '${{ secrets.GCP_SA_KEY }}'
172
-
173
- - name: Deploy to Cloud Run
174
- uses: google-github-actions/[email protected]
175
- with:
176
- image: gcr.io/cloudrun/hello
177
- service: hello-cloud-run
181
+ jobs:
182
+ job_id:
183
+ steps:
184
+ - id: 'auth'
185
+ uses: 'google-github-actions/auth@v0'
186
+ with:
187
+ credentials_json: '${{ secrets.GCP_SA_KEY }}'
188
+
189
+ - name: 'Deploy to Cloud Run'
190
+ uses: 'google-github-actions/[email protected] '
191
+ with:
192
+ image: 'gcr.io/cloudrun/hello'
193
+ service: 'hello-cloud-run'
178
194
` ` `
179
195
180
196
# ## Via Application Default Credentials
@@ -185,11 +201,14 @@ authenticate requests as the service account attached to the instance. **This
185
201
only works using a custom runner hosted on GCP.**
186
202
187
203
` ` ` yaml
188
- - name: Deploy to Cloud Run
189
- uses: google-github-actions/[email protected]
190
- with:
191
- image: gcr.io/cloudrun/hello
192
- service: hello-cloud-run
204
+ jobs:
205
+ job_id:
206
+ steps:
207
+ - name: 'Deploy to Cloud Run'
208
+ uses: 'google-github-actions/[email protected] '
209
+ with:
210
+ image: 'gcr.io/cloudrun/hello'
211
+ service: 'hello-cloud-run'
193
212
` ` `
194
213
195
214
# # Example Workflows
@@ -245,36 +264,42 @@ git push YOUR-FORK main:example-build-deploy
245
264
Example using `setup-gcloud` :
246
265
247
266
` ` ` YAML
248
- - name: Setup Cloud SDK
249
- uses: google-github-actions/[email protected]
250
- with:
251
- project_id: ${{ env.PROJECT_ID }}
252
- service_account_key: ${{ secrets.GCP_SA_KEY }}
253
-
254
- - name: Deploy to Cloud Run
255
- run: |-
256
- gcloud run deploy $SERVICE \
257
- --region $REGION \
258
- --image gcr.io/$PROJECT_ID/$SERVICE \
259
- --platform managed \
260
- --set-env-vars NAME="Hello World"
267
+ jobs:
268
+ job_id:
269
+ steps:
270
+ - name: 'Setup Cloud SDK'
271
+ uses: 'google-github-actions/setup-gcloud@v0'
272
+ with:
273
+ project_id: '${{ env.PROJECT_ID }}'
274
+ service_account_key: '${{ secrets.GCP_SA_KEY }}'
275
+
276
+ - name: 'Deploy to Cloud Run'
277
+ run: |-
278
+ gcloud run deploy $SERVICE \
279
+ --region $REGION \
280
+ --image gcr.io/$PROJECT_ID/$SERVICE \
281
+ --platform managed \
282
+ --set-env-vars NAME="Hello World"
261
283
` ` `
262
284
263
285
Migrated to `deploy-cloudrun` :
264
286
265
287
` ` ` YAML
266
- - id: 'auth'
267
- uses: 'google-github-actions/[email protected] '
268
- with:
269
- credentials_json: '${{ secrets.GCP_SA_KEY }}'
270
-
271
- - name: Deploy to Cloud Run
272
- uses: google-github-actions/[email protected]
273
- with:
274
- service: ${{ env.SERVICE }}
275
- image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}
276
- region: ${{ env.REGION }}
277
- env_vars: NAME="Hello World"
288
+ jobs:
289
+ job_id:
290
+ steps:
291
+ - id: 'auth'
292
+ uses: 'google-github-actions/auth@v0'
293
+ with:
294
+ credentials_json: '${{ secrets.GCP_SA_KEY }}'
295
+
296
+ - name: 'Deploy to Cloud Run'
297
+ uses: 'google-github-actions/[email protected] '
298
+ with:
299
+ service: '${{ env.SERVICE }}'
300
+ image: 'gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}'
301
+ region: '${{ env.REGION }}'
302
+ env_vars: 'NAME="Hello World"'
278
303
` ` `
279
304
Note : The action is for the "managed" platform and will not set access privileges such as [allowing unauthenticated requests](#Allow-unauthenticated-requests).
280
305
0 commit comments