Files
2026-07-13 13:05:14 +08:00

148 lines
4.4 KiB
YAML

name: Reusable Upload rerun_js
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-js
cancel-in-progress: true
defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
permissions:
contents: "write"
id-token: "write"
pull-requests: "write"
jobs:
upload-web:
name: Upload rerun_js to google cloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- name: Download rerun_js package
uses: actions/download-artifact@v4
with:
name: rerun_js
path: rerun_js_package
# Upload the wasm, html etc to a Google cloud bucket:
- id: "auth"
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: Get sha
id: get-sha
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 rerun_js (commit)"
if: ${{ !inputs.NIGHTLY }}
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/commit/${{ steps.get-sha.outputs.sha }}/rerun_js"
parent: false
process_gcloudignore: false
gzip: false
- name: "Upload rerun_js (tagged)"
if: inputs.MARK_TAGGED_VERSION
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/version/${{inputs.RELEASE_VERSION}}/rerun_js"
parent: false
process_gcloudignore: false
gzip: false
- name: "Upload rerun_js (adhoc)"
if: ${{ inputs.ADHOC_NAME != '' }}
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/adhoc/${{inputs.ADHOC_NAME}}/rerun_js"
parent: false
process_gcloudignore: false
gzip: false
- name: "Upload rerun_js (prerelease)"
if: github.ref == 'refs/heads/main'
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/prerelease/rerun_js"
parent: false
process_gcloudignore: false
headers: |-
cache-control: no-cache, max-age=0
gzip: false
- name: "Upload rerun_js (main)"
if: github.ref == 'refs/heads/main'
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/version/main/rerun_js"
parent: false
process_gcloudignore: false
headers: |-
cache-control: no-cache, max-age=0
gzip: false
- name: "Upload rerun_js (pr)"
if: ${{ inputs.PR_NUMBER != '' }}
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/pr/${{ inputs.PR_NUMBER }}/rerun_js"
parent: false
process_gcloudignore: false
headers: |-
cache-control: no-cache, max-age=0
gzip: false
- name: "Upload rerun_js (nightly)"
if: ${{ inputs.NIGHTLY }}
uses: google-github-actions/upload-cloud-storage@v3
with:
path: "rerun_js_package"
destination: "rerun-builds/version/nightly/rerun_js"
parent: false
process_gcloudignore: false
headers: |-
cache-control: no-cache, max-age=0
gzip: false