2023-05-09 13:25:56 +00:00
|
|
|
import { exec } from './lib/exec'
|
2023-04-25 11:01:25 +00:00
|
|
|
import { getLatestVersion, publish, setAllVersions } from './lib/publishing'
|
Uploading the static assets to R2 bucket (#3921)
Uploads all the folders inside `./assets` folder to a new R2 bucket
called `cdn`. Uses the package version as the prefix, so that we can
host multiple versions of the assets.
### Change Type
<!-- ❗ Please select a 'Scope' label ❗️ -->
- [ ] `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
- [x] `internal` — Does not affect user-facing stuff
<!-- ❗ Please select a 'Type' label ❗️ -->
- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [x] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
### Test Plan
1. Add a step-by-step description of how to test your PR here.
2.
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Upload our static assets (fonts, icons, embed-icons, translations) to
a R2 bucket so that we can move away from using unpkg and start using
our own cdn.
2024-06-14 12:25:42 +00:00
|
|
|
import { uploadStaticAssets } from './upload-static-assets'
|
2023-04-25 11:01:25 +00:00
|
|
|
|
2023-05-09 13:25:56 +00:00
|
|
|
async function main() {
|
|
|
|
const sha = (await exec('git', ['rev-parse', 'HEAD'])).trim().slice(0, 12)
|
2023-04-25 11:01:25 +00:00
|
|
|
|
2024-03-04 09:39:19 +00:00
|
|
|
async function setCanaryVersions() {
|
2024-02-29 16:28:11 +00:00
|
|
|
const latestVersion = await getLatestVersion()
|
2023-04-25 11:01:25 +00:00
|
|
|
|
2023-05-09 13:25:56 +00:00
|
|
|
const nextVersion = latestVersion.prerelease.length
|
|
|
|
? // if the package is in prerelease mode, we want to release a canary for the current version rather than bumping
|
2024-02-07 16:02:22 +00:00
|
|
|
latestVersion
|
2024-03-04 09:39:19 +00:00
|
|
|
: latestVersion?.inc('minor')
|
2023-05-09 13:25:56 +00:00
|
|
|
const versionString = `${nextVersion.major}.${nextVersion.minor}.${nextVersion.patch}-canary.${sha}`
|
2023-04-25 11:01:25 +00:00
|
|
|
|
2024-02-29 17:38:19 +00:00
|
|
|
await setAllVersions(versionString)
|
Uploading the static assets to R2 bucket (#3921)
Uploads all the folders inside `./assets` folder to a new R2 bucket
called `cdn`. Uses the package version as the prefix, so that we can
host multiple versions of the assets.
### Change Type
<!-- ❗ Please select a 'Scope' label ❗️ -->
- [ ] `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
- [x] `internal` — Does not affect user-facing stuff
<!-- ❗ Please select a 'Type' label ❗️ -->
- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [x] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
### Test Plan
1. Add a step-by-step description of how to test your PR here.
2.
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Upload our static assets (fonts, icons, embed-icons, translations) to
a R2 bucket so that we can move away from using unpkg and start using
our own cdn.
2024-06-14 12:25:42 +00:00
|
|
|
return versionString
|
2023-05-09 13:25:56 +00:00
|
|
|
}
|
2023-04-25 11:01:25 +00:00
|
|
|
|
|
|
|
// module was called directly
|
|
|
|
|
Uploading the static assets to R2 bucket (#3921)
Uploads all the folders inside `./assets` folder to a new R2 bucket
called `cdn`. Uses the package version as the prefix, so that we can
host multiple versions of the assets.
### Change Type
<!-- ❗ Please select a 'Scope' label ❗️ -->
- [ ] `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
- [x] `internal` — Does not affect user-facing stuff
<!-- ❗ Please select a 'Type' label ❗️ -->
- [ ] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [x] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
### Test Plan
1. Add a step-by-step description of how to test your PR here.
2.
- [ ] Unit Tests
- [ ] End to end tests
### Release Notes
- Upload our static assets (fonts, icons, embed-icons, translations) to
a R2 bucket so that we can move away from using unpkg and start using
our own cdn.
2024-06-14 12:25:42 +00:00
|
|
|
const versionString = await setCanaryVersions()
|
|
|
|
await uploadStaticAssets(versionString)
|
|
|
|
await publish('canary')
|
2023-04-25 11:01:25 +00:00
|
|
|
}
|
2023-05-09 13:25:56 +00:00
|
|
|
|
|
|
|
main()
|