-
Notifications
You must be signed in to change notification settings - Fork 373
130 lines (115 loc) · 3.83 KB
/
reusable_upload_web.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
name: Reusable Upload Web
on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
ADHOC_NAME:
type: string
required: false
default: ""
MARK_TAGGED_VERSION:
required: false
type: boolean
default: false
RELEASE_VERSION:
required: false
type: string
default: "prerelease"
PR_NUMBER:
required: false
type: string
default: ""
NIGHTLY:
required: false
type: boolean
default: false
concurrency:
group: ${{ inputs.CONCURRENCY }}-upload-web
cancel-in-progress: true
jobs:
upload-web:
name: Upload web build to google cloud (wasm32 + wasm-bindgen)
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- name: Download Web Viewer
uses: actions/download-artifact@v3
with:
name: web_viewer
path: web_viewer
# Upload the wasm, html etc to a Google cloud bucket:
- id: "auth"
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: Get sha
id: get-sha
shell: bash
run: |
full_commit="${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha }}"
echo "sha=$(echo $full_commit | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: "Upload web-viewer (commit)"
if: ${{ !inputs.NIGHTLY }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/commit/${{ steps.get-sha.outputs.sha }}"
parent: false
- name: "Upload web-viewer (tagged)"
if: inputs.MARK_TAGGED_VERSION
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/version/${{inputs.RELEASE_VERSION}}"
parent: false
- name: "Upload web-viewer (adhoc)"
if: ${{ inputs.ADHOC_NAME != '' }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/adhoc/${{inputs.ADHOC_NAME}}"
parent: false
- name: "Upload web-viewer (prerelease)"
if: github.ref == 'refs/heads/main'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/prerelease"
parent: false
headers: |-
cache-control: no-cache, max-age=0
- name: "Upload web-viewer (main)"
if: github.ref == 'refs/heads/main'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/version/main"
parent: false
headers: |-
cache-control: no-cache, max-age=0
- name: "Upload web-viewer (pr)"
if: ${{ inputs.PR_NUMBER != '' }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/pr/${{ inputs.PR_NUMBER }}"
parent: false
headers: |-
cache-control: no-cache, max-age=0
- name: "Upload web-viewer (nightly)"
if: ${{ inputs.NIGHTLY }}
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "web_viewer"
destination: "rerun-web-viewer/version/nightly"
parent: false
headers: |-
cache-control: no-cache, max-age=0