-
Notifications
You must be signed in to change notification settings - Fork 116
/
action.yml
318 lines (254 loc) · 10.9 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: 'Deploy to Cloud Run'
author: 'Google LLC'
description: |-
Use this action to deploy a container or source code to Google Cloud Run.
inputs:
service:
description: |-
ID of the service or fully-qualified identifier of the service. This is
required unless providing `metadata` or `job`.
required: false
job:
description: |-
ID of the job or fully-qualified identifier of the job. This is required
unless providing `metadata` or `service`.
required: false
metadata:
description: |-
YAML service description for the Cloud Run service. This is required
unless providing `service` or `job`.
required: false
image:
description: |-
(Required, unless providing `metadata` or `source`) Fully-qualified name
of the container image to deploy. For example:
gcr.io/cloudrun/hello:latest
or
us-docker.pkg.dev/my-project/my-container/image:1.2.3
required: false
source:
description: |-
(Required, unless providing `metadata`, `image`, or `job`) Path to source
to deploy. If specified, this will deploy the Cloud Run service from the
code specified at the given source directory.
Learn more about the required permissions in [Deploying from source
code](https://cloud.google.com/run/docs/deploying-source-code).
required: false
suffix:
description: |-
String suffix to append to the revision name. Revision names always start
with the service name automatically. For example, specifying `v1` for a
service named `helloworld`, would lead to a revision named
`helloworld-v1`. This option is only applies to services.
required: false
env_vars:
description: |-
List of environment variables that should be set in the environment.
These are comma-separated or newline-separated `KEY=VALUE`. Keys or values
that contain separators must be escaped with a backslash (e.g. `\,` or
`\\n`) unless quoted. Any leading or trailing whitespace is trimmed unless
values are quoted.
env_vars: |-
FRUIT=apple
SENTENCE=" this will retain leading and trailing spaces "
This value will only be set if the input is a non-empty value. If a
non-empty value is given, the field values will be overwritten (not
merged). To remove all values, set the value to the literal string `{}`.
If both `env_vars` and `env_vars_file` are specified, the keys in
`env_vars` will take precendence over the keys in `env_vars_file`.
required: false
env_vars_file:
description: |-
Path to a file on disk, relative to the workspace, that defines
environment variables. The file can be newline-separated KEY=VALUE pairs,
JSON, or YAML format. If both `env_vars` and `env_vars_file` are
specified, the keys in env_vars will take precendence over the keys in
env_vars_file.
NAME=person
EMAILS=foo@bar.com\,zip@zap.com
When specified as KEY=VALUE pairs, the same escaping rules apply as
described in `env_vars`. You do not have to escape YAML or JSON.
If both `env_vars` and `env_vars_file` are specified, the keys in
`env_vars` will take precendence over the keys in `env_vars_file`.
**⚠️ DEPRECATION NOTICE:** This input is deprecated and will be removed in
the next major version release.
required: false
env_vars_update_strategy:
description: |-
Controls how the environment variables are set on the Cloud Run service.
If set to "merge", then the environment variables are _merged_ with any
upstream values. If set to "overwrite", then all environment variables on
the Cloud Run service will be replaced with exactly the values given by
the GitHub Action (making it authoritative).
default: 'merge'
required: true
secrets:
description: |-
List of KEY=VALUE pairs to use as secrets. These are comma-separated or
newline-separated `KEY=VALUE`. Keys or values that contain separators must
be escaped with a backslash (e.g. `\,` or `\\n`) unless quoted. Any
leading or trailing whitespace is trimmed unless values are quoted.
These can either be injected as environment variables or mounted as
volumes. Keys starting with a forward slash '/' are mount paths. All other
keys correspond to environment variables:
with:
secrets: |-
# As an environment variable:
KEY1=secret-key-1:latest
# As a volume mount:
/secrets/api/key=secret-key-2:latest
This value will only be set if the input is a non-empty value. If a
non-empty value is given, the field values will be overwritten (not
merged). To remove all values, set the value to the literal string `{}`.
required: false
secrets_update_strategy:
description: |-
Controls how the secrets are set on the Cloud Run service. If set to
`merge`, then the secrets are merged with any upstream values. If set to
`overwrite`, then all secrets on the Cloud Run service will be replaced
with exactly the values given by the GitHub Action (making it
authoritative).
default: 'merge'
required: true
labels:
description: |-
List of labels that should be set on the function. These are
comma-separated or newline-separated `KEY=VALUE`. Keys or values that
contain separators must be escaped with a backslash (e.g. `\,` or `\\n`)
unless quoted. Any leading or trailing whitespace is trimmed unless values
are quoted.
labels: |-
labela=my-label
labelb=my-other-label
This value will only be set if the input is a non-empty value. If a
non-empty value is given, the field values will be overwritten (not
merged). To remove all values, set the value to the literal string `{}`.
Google Cloud restricts the allowed values and length for labels. Please
see the Google Cloud documentation for labels for more information.
required: false
skip_default_labels:
description: |-
Skip applying the special annotation labels that indicate the deployment
came from GitHub Actions. The GitHub Action will automatically apply the
following labels which Cloud Run uses to enhance the user experience:
managed-by: github-actions
commit-sha: <sha>
Setting this to `true` will skip adding these special labels.
required: false
default: 'false'
tag:
description: |-
Traffic tag to assign to the newly-created revision. This option is only
applies to services.
required: false
timeout:
description: |-
Maximum request execution time, specified as a duration like "10m5s" for
ten minutes and 5 seconds.
required: false
flags:
description: |-
Space separate list of additional Cloud Run flags to pass to the deploy
command. This can be used to apply advanced features that are not exposed
via this GitHub Action. For Cloud Run services, this command will be
`gcloud run deploy`. For Cloud Run jobs, this command will be `gcloud jobs
deploy.
with:
flags: '--add-cloudsql-instances=...'
Flags that include other flags must quote the _entire_ outer flag value. For
example, to pass `--args=-X=123`:
with:
flags: '--add-cloudsql-instances=... "--args=-X=123"'
See the [complete list of
flags](https://cloud.google.com/sdk/gcloud/reference/run/deploy#FLAGS) for
more information.
Please note, this GitHub Action does not parse or validate the flags. You
are responsible for making sure the flags are available on the gcloud
version and subcommand.
required: false
no_traffic:
description: |-
If true, the newly deployed revision will not receive traffic. This option
is only applies to services.
default: 'false'
required: false
revision_traffic:
description: |-
Comma-separated list of revision traffic assignments.
with:
revision_traffic: 'my-revision=10' # percentage
To update traffic to the latest revision, use the special tag "LATEST":
with:
revision_traffic: 'LATEST=100'
This is mutually-exclusive with `tag_traffic`. This option is only applies
to services.
required: false
tag_traffic:
description: |-
Comma-separated list of tag traffic assignments.
with:
tag_traffic: 'my-tag=10' # percentage
This is mutually-exclusive with `revision_traffic`. This option is only
applies to services.
required: false
update_traffic_flags:
description: |-
Space separate list of additional Cloud Run flags to pass to the `gcloud
run services update-traffic` command. This can be used to apply advanced
features that are not exposed via this GitHub Action. This flag only
applies with `revision_traffic` or `tag_traffic` is set.
with:
traffic_flags: '--set-tags=...'
Flags that include other flags must quote the _entire_ outer flag value. For
example, to pass `--args=-X=123`:
with:
flags: '--set-tags=... "--args=-X=123"'
See the [complete list of
flags](https://cloud.google.com/sdk/gcloud/reference/run/services/update#FLAGS)
for more information.
Please note, this GitHub Action does not parse or validate the flags. You
are responsible for making sure the flags are available on the gcloud
version and subcommand.
required: false
project_id:
description: |-
ID of the Google Cloud project in which to deploy the service.
required: false
region:
description: |-
Region in which the Cloud Run services are deployed.
default: 'us-central1'
required: false
gcloud_version:
description: |-
Version of the Cloud SDK to install. If unspecified or set to "latest",
the latest available gcloud SDK version for the target platform will be
installed. Example: "290.0.1".
required: false
gcloud_component:
description: |-
Version of the Cloud SDK components to install and use.
required: false
outputs:
url:
description: |-
The URL of the Cloud Run service.
branding:
icon: 'chevrons-right'
color: 'blue'
runs:
using: 'node20'
main: 'dist/main/index.js'