Migrate @kadena/docs to use Vercel CLI to deploy to preview environments.
Deploy to Vercel using Vercel CLI instead of Vercel/Github Integration
Related Issue/Asana ticket: https://app.asana.com/0/1206316065856327/1207502646350161/f
Short description: This PR adds preview deployments for @kadena/docs by using the Vercel CLI instead of relying on the Vercel/GitHub integration. This allows us to build our apps on GitHub runners and then upload prebuilt sources for deployment. For Docs this reduces deployment time from around 6-7 minutes to around 40-60 seconds. This should greatly reduce the time developers need to spent waiting for their deployment to be ready, especially when all other apps are migrated too
The deployment workflow uses turbo-ignore to check for differences between the current branch and the base branch to determine if a deployment for an app is required. If a deployment is required, the Vercel CLI wil pull environment variables, build the app, create a tgz archive and upload to Vercel after which a deployment will be triggered.
The deployment URL is then added to environments like so:
In short, this results in the following benefits:
- Full control over Turbo Ignore and which branch we use to compare to when determining if a deployment is needed.
- Faster App deployments as we don't need to wait on Vercel to fully rebuild our apps.
- Many apps can be built in parallel, in Vercel only 2 (up to 12 if we pay more)
- Developers don't need access to Vercel to deploy, they need to be able to run Workflows.
- Deployment failures are echo'd in GitHub Actions instead of having to go to Vercel
Unfortunately, it's not all sunshine and rainbows there are also a few disadvantages. We lose branch-names for preview URLs. So instead of a branch name like https://alpha-docs-git-feat-kadena-clipactjs-kadena-js.vercel.app/, the generated preview url is more like https://alpha-docs-3dn06fmjg-kadena-js.vercel.app/
Tasks
- [X] Use Turbo Ignore to detect changes to base branch
- [X] Pull environment variables from preview
- [X] Deploy prebuilt artifact to Vercel
- [X] Add Preview URL to PR
- [X] Add Metadata to deployment to easily identify all deployments associated with a PR. Use
<repository>-<pr_number> - [X] Delete all preview environments associated with a PR when merging a PR
- [ ] Refactor workflow to support Matrix runs for the individual apps
Test scenarios
- Should deploy if changes have been detected to the package
- Should deploy if dependencies have changed
- Should Add deployment URL to PR
- Should use the correct environment variables for the deployment
Reminders (if applicable)
- [X] I ran
pnpm installandpnpm testin the root of the monorepo (optionally with--filter=...package...to exclude non-affected projects) - [X] I ran
pnpm changesetin the root of the monorepo - [X] Test coverage has not decreased
- [X] Docs have been updated to reflect changes in PR (don't forget docs.kadena.io)
⚠️ No Changeset found
Latest commit: ad285857aa060b845d23d4cf3ca77224860d95f5
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| explorer | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 11, 2024 6:01pm |
| kadena-js-explorer | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 11, 2024 6:01pm |
| marmalade-marketplace | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 11, 2024 6:01pm |
| proof-of-us | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 11, 2024 6:01pm |
5 Ignored Deployments
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| alpha-docs | ⬜️ Ignored (Inspect) | Visit Preview | Jun 11, 2024 6:01pm | |
| dev-wallet | ⬜️ Ignored (Inspect) | Visit Preview | Jun 11, 2024 6:01pm | |
| kadena-js-marmalade-marketplace | ⬜️ Ignored (Inspect) | Visit Preview | Jun 11, 2024 6:01pm | |
| react-ui | ⬜️ Ignored (Inspect) | Visit Preview | Jun 11, 2024 6:01pm | |
| tools | ⬜️ Ignored (Inspect) | Visit Preview | Jun 11, 2024 6:01pm |
This PR is stale because it is open for 60 days with no activity
@alber70g your call
This PR is stale because it is open for 60 days with no activity
Based on recent features in Vercel this PR shouldn't be needed anymore. It's unlikely that the added benefit outweighs the maintenance and complexity.