Skip to content

Commit 2faba52

Browse files
authored
Add support for universes, update deps, switch to auto-doc (#365)
1 parent dde5fe1 commit 2faba52

7 files changed

Lines changed: 325 additions & 198 deletions

File tree

README.md

Lines changed: 63 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -185,145 +185,142 @@ If `parent` is set to `false`, it wil be uploaded to `gs://bucket-name/folder2/f
185185

186186
## Inputs
187187

188-
- `path` - (Required) The path to a file or folder inside the action's
189-
filesystem that should be uploaded to the bucket.
188+
<!-- BEGIN_AUTOGEN_INPUTS -->
189+
190+
- <a name="project_id"></a><a href="#user-content-project_id"><code>project_id</code></a>: _(Optional)_ Google Cloud project ID to use for billing and API requests. If not
191+
provided, the project will be inferred from the environment, best-effort.
192+
To explicitly set the value:
193+
194+
```yaml
195+
project_id: 'my-project'
196+
```
197+
198+
- <a name="universe"></a><a href="#user-content-universe"><code>universe</code></a>: _(Optional, default: `googleapis.com`)_ The Google Cloud universe to use for constructing API endpoints. Trusted
199+
Partner Cloud and Google Distributed Hosted Cloud should set this to their
200+
universe address.
201+
202+
You can also override individual API endpoints by setting the environment
203+
variable `GHA_ENDPOINT_OVERRIDE_<endpoint>` where `<endpoint>` is the API
204+
endpoint to override. For example:
205+
206+
```yaml
207+
env:
208+
GHA_ENDPOINT_OVERRIDE_oauth2: 'https://oauth2.myapi.endpoint/v1'
209+
```
210+
211+
For more information about universes, see the Google Cloud documentation.
212+
213+
- <a name="path"></a><a href="#user-content-path"><code>path</code></a>: _(Required)_ The path to a file or folder inside the action's filesystem that should be
214+
uploaded to the bucket.
190215

191216
You can specify either the absolute path or the relative path from the
192217
action:
193218

194219
```yaml
195-
path: /path/to/file
220+
path: '/path/to/file'
196221
```
197222

198223
```yaml
199-
path: ../path/to/file
224+
path: '../path/to/file'
200225
```
201226

202-
- `destination` - (Required) The destination for the file/folder in the form
203-
bucket-name or with an optional prefix in the form bucket-name/prefix
227+
- <a name="destination"></a><a href="#user-content-destination"><code>destination</code></a>: _(Required)_ The destination for the file/folder in the form bucket-name or with an
228+
optional prefix in the form `bucket-name/prefix`. For example, to upload a
229+
file named `file` to the GCS bucket `bucket-name`:
204230

205231
```yaml
206-
destination: bucket-name
232+
destination: 'bucket-name'
207233
```
208234

209-
In the above example, the file will be uploaded to gs://bucket-name/file
235+
To upload to a subfolder:
210236

211237
```yaml
212-
destination: bucket-name/prefix
238+
destination: 'bucket-name/prefix'
213239
```
214240

215-
In the above example, the file will be uploaded to
216-
gs://bucket-name/prefix/file
217-
218-
- `gzip` - (Optional) Upload file(s) with gzip content encoding, defaults to
219-
true.
241+
- <a name="gzip"></a><a href="#user-content-gzip"><code>gzip</code></a>: _(Optional, default: `true`)_ Upload file(s) with gzip content encoding. To disable gzip
242+
content-encoding, set the value to false:
220243

221244
```yaml
222245
gzip: false
223246
```
224247

225-
In the above example, the file(s) will be uploaded without `gzip`
226-
content-encoding
227-
228-
- `resumable` - (Optional) Enable resumable uploads, defaults to true.
248+
- <a name="resumable"></a><a href="#user-content-resumable"><code>resumable</code></a>: _(Optional, default: `true`)_ Enable resumable uploads. To disable resumable uploads, set the value to
249+
false:
229250

230251
```yaml
231252
resumable: false
232253
```
233254

234-
- `predefinedAcl` - (Optional) Apply a predefined set of access controls to
235-
the file(s).
255+
- <a name="predefinedAcl"></a><a href="#user-content-predefinedAcl"><code>predefinedAcl</code></a>: _(Optional)_ Apply a predefined set of access controls to the files being uploaded. For
256+
example, to grant project team members access to the uploaded files
257+
according to their roles:
236258

237259
```yaml
238-
predefinedAcl: projectPrivate
260+
predefinedAcl: 'projectPrivate'
239261
```
240262

241-
In the above example, project team members get access to the uploaded
242-
file(s) according to their roles.
243-
244263
Acceptable values are: `authenticatedRead`, `bucketOwnerFullControl`,
245264
`bucketOwnerRead`, `private`, `projectPrivate`, `publicRead`. See [the
246265
document](https://googleapis.dev/nodejs/storage/latest/global.html#UploadOptions)
247266
for details.
248267

249-
- `headers` - (Optional) Set object metadata.
268+
- <a name="headers"></a><a href="#user-content-headers"><code>headers</code></a>: _(Optional)_ Set object metadata. For example, to set the `Content-Type` header to
269+
`application/json` and custom metadata with key `custom-field` and value
270+
`custom-value`:
250271

251272
```yaml
252273
headers: |-
253-
content-type: application/json
254-
x-goog-meta-custom-field: custom-value
274+
content-type: 'application/json'
275+
x-goog-meta-custom-field: 'custom-value'
255276
```
256277

257-
In the above example, file `Content-Type` will be set to `application/json`
258-
and custom metadata with key `custom-field` and value `custom-value` will be
259-
added to it.
260-
261278
Settable fields are: `cache-control`, `content-disposition`,
262279
`content-encoding`, `content-language`, `content-type`, `custom-time`. See
263280
[the
264281
document](https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#settable-fields;-field-values)
265-
for details.
266-
267-
All custom metadata fields must be prefixed with `x-goog-meta-`.
282+
for details. All custom metadata fields must be prefixed with
283+
`x-goog-meta-`.
268284

269-
- `parent` - (Optional) Whether parent dir should be included in GCS
270-
destination, defaults to true.
285+
- <a name="parent"></a><a href="#user-content-parent"><code>parent</code></a>: _(Optional, default: `true`)_ Whether the parent directory should be included in GCS destination path. To disable this:
271286

272287
```yaml
273288
parent: false
274289
```
275290

276-
- `glob` - (Optional) Glob pattern.
291+
- <a name="glob"></a><a href="#user-content-glob"><code>glob</code></a>: _(Optional)_ Glob pattern to match for files to upload.
277292

278293
```yaml
279294
glob: '*.txt'
280295
```
281296

282-
- `concurrency` - (Optional) Number of files to simultaneously upload,
283-
defaults to 100.
297+
- <a name="concurrency"></a><a href="#user-content-concurrency"><code>concurrency</code></a>: _(Optional, default: `100`)_ Number of files to simultaneously upload.
284298

285299
```yaml
286-
concurrency: 10
300+
concurrency: '10'
287301
```
288302

289-
- `process_gcloudignore` - (Optional) Process a `.gcloudignore` file present
290-
in the top-level of the repository. If true, the file is parsed and any
291-
filepaths that match are not uploaded to the storage bucket. Defaults to
292-
true.
303+
- <a name="process_gcloudignore"></a><a href="#user-content-process_gcloudignore"><code>process_gcloudignore</code></a>: _(Optional, default: `true`)_ Process a `.gcloudignore` file present in the top-level of the repository.
304+
If true, the file is parsed and any filepaths that match are not uploaded
305+
to the storage bucket. To disable, set the value to false:
293306

294307
```yaml
295-
process_gcloudignore: true
308+
process_gcloudignore: false
296309
```
297310

298-
- `project_id` - (Optional) Google Cloud project ID to use for billing and API
299-
requests. By default, this is extracted from the running environment.
300311

301-
```yaml
302-
project_id: 'my-project'
303-
```
312+
<!-- END_AUTOGEN_INPUTS -->
313+
304314

305315
## Outputs
306316

307-
List of successfully uploaded file(s).
317+
<!-- BEGIN_AUTOGEN_OUTPUTS -->
308318

309-
For example:
319+
- `uploaded`: Comma-separated list of files that were uploaded.
310320

311-
```yaml
312-
- id: 'upload-file'
313-
uses: 'google-github-actions/upload-cloud-storage@v2'
314-
with:
315-
path: '/path/to/file'
316-
destination: 'bucket-name/file'
317-
```
318321

319-
will be available in future steps as the output "uploaded":
322+
<!-- END_AUTOGEN_OUTPUTS -->
320323

321-
```yaml
322-
- id: 'publish'
323-
uses: 'foo/bar@v1'
324-
env:
325-
file: '${{ steps.upload-file.outputs.uploaded }}'
326-
```
327324

328325
## Authorization
329326

0 commit comments

Comments
 (0)