earthtojake--text-to-cad
60 行
1.7 KiB
YAML
60 行
1.7 KiB
YAML
name: Upload Models
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: Branch, tag, or SHA to upload models from. Use a source branch; main does not contain models/.
|
|
required: true
|
|
default: develop
|
|
type: string
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
description: Branch, tag, or SHA to upload models from.
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: upload-models
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
upload:
|
|
name: Upload models catalog
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out upload ref
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: viewer/package-lock.json
|
|
|
|
- name: Install viewer dependencies
|
|
run: npm ci --prefix viewer
|
|
|
|
- name: Upload viewer models catalog
|
|
env:
|
|
VIEWER_VERCEL_BLOB_READ_WRITE_TOKEN: ${{ secrets.VIEWER_VERCEL_BLOB_READ_WRITE_TOKEN }}
|
|
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
|
|
run: |
|
|
if [ ! -d models ]; then
|
|
echo "No models directory at this ref; upload from a source branch such as develop." >&2
|
|
exit 1
|
|
fi
|
|
if [ -z "${VIEWER_VERCEL_BLOB_READ_WRITE_TOKEN:-}" ] && [ -z "${BLOB_READ_WRITE_TOKEN:-}" ]; then
|
|
echo "Missing VIEWER_VERCEL_BLOB_READ_WRITE_TOKEN or BLOB_READ_WRITE_TOKEN secret." >&2
|
|
exit 1
|
|
fi
|
|
scripts/viewer/upload-viewer-models-catalog.sh "$PWD/models" --skip-existing --fetch-missing-lfs
|