/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/deploy-templates.yml
98 строк
3 KB
Mime Čuvalo
fix(ci): build workspace types before deploying the templates (#9942)
10 авг 2026, 14:52
Не верифицирован
10 авг 2026, 14:52
ea97ad4
Код
Авторство
О чём код?
name: Deploy templates # Deploys the cloudflare-hosted starter kit demos at *.templates.tldraw.dev, which are the live # embeds on the docs pages. Two things should reach them: a change to a template (so edits go live # without waiting for a release), and a release (so the demos pick up the new SDK — an SDK bump # never touches templates/, so the path filter alone would never fire for one). # # The vercel-hosted demos (chat, shader, workflow) deploy through vercel's own git integration and # aren't handled here. on: push: branches: - main paths: - 'templates/**' workflow_dispatch: workflow_call: # the cloudflare credentials aren't listed here: they're secrets on the deploy-production # environment, which the job below selects. `workflow_call` has no `environment` keyword, so # they can't be passed in by a caller — an environment secret always wins over a passed one. secrets: TEMPLATES_TLDRAW_LICENSE_KEY: required: true DISCORD_DEPLOY_WEBHOOK_URL: required: false env: CI: 1 PRINT_GITHUB_ANNOTATIONS: 1 ALLOW_REFRESH_ASSETS_CHANGES: 1 defaults: run: shell: bash permissions: contents: read jobs: deploy: name: Deploy templates # CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are secrets on this environment rather than on # the repository, so the job has to select it to see them at all. environment: deploy-production timeout-minutes: 60 runs-on: ubuntu-latest-16-cores-arm-open # a release deploy and a template-change deploy can otherwise race each other onto the same # custom domains, and the loser silently wins. concurrency: group: deploy-templates cancel-in-progress: false steps: - name: Check out code uses: actions/checkout@v6 with: persist-credentials: false - 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 run: yarn build-types - name: Deploy templates env: TEMPLATES_TLDRAW_LICENSE_KEY: ${{ secrets.TEMPLATES_TLDRAW_LICENSE_KEY }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.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 - name: Notify Discord on failure if: failure() uses: ./.github/actions/discord-fail-notify with: webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}