2024-01-16 14:38:05 +00:00
|
|
|
name: Deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- production
|
|
|
|
|
|
|
|
env:
|
|
|
|
CI: 1
|
|
|
|
PRINT_GITHUB_ANNOTATIONS: 1
|
2024-01-17 14:24:57 +00:00
|
|
|
TLDRAW_ENV: ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }}
|
2024-01-16 14:38:05 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
2024-01-17 14:24:57 +00:00
|
|
|
name: Deploy to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }}
|
2024-01-16 14:38:05 +00:00
|
|
|
timeout-minutes: 15
|
|
|
|
runs-on: ubuntu-latest-16-cores-open
|
2024-01-17 14:24:57 +00:00
|
|
|
environment: ${{ github.ref == 'refs/heads/production' && 'deploy-production' || 'deploy-staging' }}
|
|
|
|
concurrency: ${{ github.ref == 'refs/heads/production' && 'deploy-production' || github.ref }}
|
2024-01-16 14:38:05 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Notify initial start
|
|
|
|
uses: MineBartekSA/discord-webhook@v2
|
2024-01-17 14:24:57 +00:00
|
|
|
if: github.ref == 'refs/heads/production'
|
2024-01-16 14:38:05 +00:00
|
|
|
with:
|
|
|
|
webhook: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
|
|
|
|
content: 'Preparing ${{ env.TLDRAW_ENV }} deploy: ${{ github.event.head_commit.message }} by ${{ github.event.head_commit.author.name }}'
|
|
|
|
component: |
|
|
|
|
{
|
|
|
|
"type": 2,
|
|
|
|
"style": 5,
|
|
|
|
"label": "Open in GitHub",
|
|
|
|
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
|
|
}
|
|
|
|
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- uses: ./.github/actions/setup
|
|
|
|
|
|
|
|
- name: Build types
|
|
|
|
run: yarn build-types
|
|
|
|
|
|
|
|
- name: Deploy
|
|
|
|
run: yarn tsx scripts/deploy.ts
|
|
|
|
env:
|
|
|
|
RELEASE_COMMIT_HASH: ${{ github.sha }}
|
|
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
|
|
|
|
ASSET_UPLOAD: ${{ vars.ASSET_UPLOAD }}
|
assets: make option to transform urls dynamically / LOD (#3827)
this is take #2 of this PR https://github.com/tldraw/tldraw/pull/3764
This continues the idea kicked off in
https://github.com/tldraw/tldraw/pull/3684 to explore LOD and takes it
in a different direction.
Several things here to call out:
- our dotcom version would start to use Cloudflare's image transforms
- we don't rewrite non-image assets
- we debounce zooming so that we're not swapping out images while
zooming (it creates jank)
- we load different images based on steps of .25 (maybe we want to make
this more, like 0.33). Feels like 0.5 might be a bit too much but we can
play around with it.
- we take into account network connection speed. if you're on 3g, for
example, we have the size of the image.
- dpr is taken into account - in our case, Cloudflare handles it. But if
it wasn't Cloudflare, we could add it to our width equation.
- we use Cloudflare's `fit=scale-down` setting to never scale _up_ an
image.
- we don't swap the image in until we've finished loading it
programatically (to avoid a blank image while it loads)
TODO
- [x] We need to enable Cloudflare's pricing on image transforms btw
@steveruizok 😉 - this won't work quite yet until we do that.
### Change Type
<!-- ❗ Please select a 'Scope' label ❗️ -->
- [x] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff
<!-- ❗ Please select a 'Type' label ❗️ -->
- [ ] `bugfix` — Bug fix
- [x] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
### Test Plan
1. Test images on staging, small, medium, large, mega
2. Test videos on staging
- [x] Unit Tests
- [ ] End to end tests
### Release Notes
- Assets: make option to transform urls dynamically to provide different
sized images on demand.
2024-06-11 14:17:09 +00:00
|
|
|
ASSET_BUCKET_ORIGIN: ${{ vars.ASSET_BUCKET_ORIGIN }}
|
2024-01-16 14:38:05 +00:00
|
|
|
MULTIPLAYER_SERVER: ${{ vars.MULTIPLAYER_SERVER }}
|
|
|
|
SUPABASE_LITE_URL: ${{ vars.SUPABASE_LITE_URL }}
|
|
|
|
VERCEL_PROJECT_ID: ${{ vars.VERCEL_DOTCOM_PROJECT_ID }}
|
|
|
|
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }}
|
|
|
|
|
|
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
DISCORD_DEPLOY_WEBHOOK_URL: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
|
2024-01-29 09:47:50 +00:00
|
|
|
DISCORD_HEALTH_WEBHOOK_URL: ${{ secrets.DISCORD_HEALTH_WEBHOOK_URL }}
|
|
|
|
HEALTH_WORKER_UPDOWN_WEBHOOK_PATH: ${{ secrets.HEALTH_WORKER_UPDOWN_WEBHOOK_PATH }}
|
2024-01-16 14:38:05 +00:00
|
|
|
GC_MAPS_API_KEY: ${{ secrets.GC_MAPS_API_KEY }}
|
|
|
|
WORKER_SENTRY_DSN: ${{ secrets.WORKER_SENTRY_DSN }}
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
|
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
2024-06-26 11:11:14 +00:00
|
|
|
SENTRY_CSP_REPORT_URI: ${{ secrets.SENTRY_CSP_REPORT_URI }}
|
2024-01-16 14:38:05 +00:00
|
|
|
SUPABASE_LITE_ANON_KEY: ${{ secrets.SUPABASE_LITE_ANON_KEY }}
|
|
|
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
|
|
|
|
|
|
|
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
|
|
R2_ACCESS_KEY_SECRET: ${{ secrets.R2_ACCESS_KEY_SECRET }}
|
|
|
|
|
|
|
|
APP_ORIGIN: ${{ vars.APP_ORIGIN }}
|
2024-05-22 10:04:24 +00:00
|
|
|
|
|
|
|
NEXT_PUBLIC_GOOGLE_CLOUD_PROJECT_NUMBER: ${{ vars.NEXT_PUBLIC_GOOGLE_CLOUD_PROJECT_NUMBER }}
|