-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (80 loc) · 2.43 KB
/
gcs-upload.yaml
File metadata and controls
81 lines (80 loc) · 2.43 KB
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
name: GCS Upload
on:
workflow_call:
inputs:
SOURCE:
type: string
description: "path to folder/file to upload"
required: true
DESTINATION:
type: string
description: "destination path in bucket"
required: true
GZIP:
type: boolean
description: "gzip the file"
required: false
default: true
PREDEFINEDACL:
type: string
description: "predefined acl for the file"
required: false
default: "private"
HEADERS:
type: string
description: "headers to add to the file"
required: false
default: ""
GLOB:
type: string
description: "glob pattern to match files to upload e.g. '**/*.js'"
required: false
default: null
CONCURRENCY:
type: number
description: "number of concurrent uploads"
required: false
default: 100
ARTIFACT_NAME:
type: string
description: "name of the artifact to download"
required: false
DOWNLOAD_PATH:
type: string
description: "path to download the artifact to"
required: false
default: "./download"
secrets:
GCP_JSON_KEY:
required: false
description: "can be inherited by using the 'inherit' keyword https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecretsinherit"
jobs:
gcs-upload:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v5.0.0
- name: download a build artifact
if: ${{ inputs.ARTIFACT_NAME != null }}
uses: actions/download-artifact@v6.0.0
id: download
with:
name: ${{ inputs.ARTIFACT_NAME }}
path: ${{ inputs.DOWNLOAD_PATH }}
- name: authenticate to google cloud
id: auth
uses: google-github-actions/auth@v3.0.0
with:
credentials_json: ${{ secrets.GCP_JSON_KEY }}
- id: "upload-file"
uses: "google-github-actions/upload-cloud-storage@v3.0.0"
with:
path: ${{ inputs.SOURCE }}
destination: ${{ inputs.DESTINATION }}
gzip: ${{ inputs.GZIP }}
predefinedAcl: ${{ inputs.PREDEFINEDACL }}
headers: ${{ inputs.HEADERS }}
glob: ${{ inputs.GLOB }}
parent: false
process_gcloudignore: false
concurrency: ${{ inputs.CONCURRENCY }}