Some checks failed
Deploy analytics worker / Deploy analytics worker to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
i18n upload strings / Upload latest strings (push) Failing after 1s
Deploy bemo / Deploy bemo to ${{ (github.ref == 'refs/heads/bemo-production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
Deploy grafana resources / ${{ github.event_name == 'push' && 'Deploy grafana resources' || 'Validate grafana resources (dry run)' }} (push) Failing after 0s
End to end tests (dotcom) / Check for relevant changes (push) Failing after 0s
End to end tests (examples) / Check for relevant changes (push) Failing after 0s
End to end tests (mermaid readability) / Check for relevant changes (push) Failing after 1s
End to end tests (perf) / Check for relevant changes (push) Failing after 0s
Publish editor extensions / Publish editor extensions (push) Failing after 1s
Publish SDK packages / Remove the publish-packages label (push) Has been skipped
Checks / Tests & checks (push) Has been cancelled
Checks / Build all projects (push) Has been cancelled
Deploy templates / Deploy templates (push) Has been cancelled
End to end tests (dotcom) / End to end tests (dotcom) (push) Has been cancelled
End to end tests (mermaid readability) / End to end tests (mermaid readability) (push) Has been cancelled
End to end tests (perf) / End to end tests (perf) (push) Has been cancelled
Deploy .com / Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Has been cancelled
End to end tests (examples) / End to end tests (examples) (push) Has been cancelled
Publish SDK packages / Publish SDK packages (push) Has been cancelled
Publish SDK packages / Tell user released version (push) Has been cancelled
Publish SDK packages / Publishes code templates to separate repositories (push) Has been cancelled
Publish SDK packages / Deploys the template demos with the new SDK version (push) Has been cancelled
70 lines
2.9 KiB
YAML
70 lines
2.9 KiB
YAML
name: Deploy templates
|
|
description: >
|
|
Build the starter-kit demos against the checked-out SDK and deploy the cloudflare-hosted ones to
|
|
*.templates.tldraw.dev. Shared by deploy-templates.yml (template changes, manual runs) and
|
|
publish.yml (releases). Expects the repo to be checked out already; runs the setup action itself.
|
|
|
|
# The cloudflare credentials are secrets on the deploy-production environment, so the job using
|
|
# this action has to select that environment and pass them in. This is a composite action rather
|
|
# than a workflow_call workflow because a called workflow only ever sees the secrets its caller
|
|
# hands it, and an `environment:` on a job inside the callee does not add that environment's
|
|
# secrets to them — see #10636.
|
|
inputs:
|
|
license-key:
|
|
description: tldraw license key the demos are built with (TEMPLATES_TLDRAW_LICENSE_KEY)
|
|
required: true
|
|
cloudflare-account-id:
|
|
description: Cloudflare account the workers deploy to (CLOUDFLARE_ACCOUNT_ID)
|
|
required: true
|
|
cloudflare-api-token:
|
|
description: Cloudflare API token with workers permissions (CLOUDFLARE_API_TOKEN)
|
|
required: true
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: ./.github/actions/setup
|
|
|
|
# most templates run `tsc` as part of their build, which resolves the workspace packages
|
|
# through their project references and so needs the declarations built first
|
|
- name: Build types
|
|
shell: bash
|
|
env:
|
|
# build-types pulls in refresh-assets, which rewrites the generated version files. in CI it
|
|
# exits 1 on any change to a committed asset instead of writing it, which would fail the
|
|
# deploy on a release ref whose generated files aren't already in sync.
|
|
ALLOW_REFRESH_ASSETS_CHANGES: 1
|
|
run: yarn build-types
|
|
|
|
- name: Deploy templates
|
|
shell: bash
|
|
env:
|
|
CI: 1
|
|
PRINT_GITHUB_ANNOTATIONS: 1
|
|
ALLOW_REFRESH_ASSETS_CHANGES: 1
|
|
TEMPLATES_TLDRAW_LICENSE_KEY: ${{ inputs.license-key }}
|
|
CLOUDFLARE_API_TOKEN: ${{ inputs.cloudflare-api-token }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ inputs.cloudflare-account-id }}
|
|
run: |
|
|
# the templates import tldraw/tldraw.css, which is generated and gitignored
|
|
yarn lazy prebuild
|
|
|
|
cd templates
|
|
all_templates=$(ls -d */ | cut -f1 -d'/')
|
|
cd ..
|
|
|
|
# the demos are independent of each other, so deploy them all before failing: one broken
|
|
# template shouldn't leave the rest stranded on an old build with no signal about which.
|
|
# templates with no `deploy` config in their package.json skip themselves.
|
|
failed=""
|
|
for template in $all_templates; do
|
|
echo "::group::Deploying $template"
|
|
yarn tsx ./internal/scripts/deploy-template.ts $template || failed="$failed $template"
|
|
echo "::endgroup::"
|
|
done
|
|
|
|
if [ -n "$failed" ]; then
|
|
echo "::error::Failed to deploy templates:$failed"
|
|
exit 1
|
|
fi
|