Skip to content

Commit

Permalink
Setup rerun.io deploy from docs-latest (rerun-io#5988)
Browse files Browse the repository at this point in the history
### What

Right now the workflow for updating docs on `rerun.io` is:
1. Push your changes to some branch in this repository
2. Get the hash of your latest commit
3. Login to our project on Vercel
4. Manually update the `RELEASE_COMMIT` env var
5. Trigger a redeploy of the latest production deployment

After this PR, the new workflow will be:
1. Cherry-pick any docs commits to the `docs-latest` branch

`rerun.io` now always fetches docs from the `docs-latest` branch,
instead of a specific commit hash. Any push to `docs-latest` will
trigger a redeploy of the website.

The release workflow has been updated to no longer deploy the website,
and instead only update the `RELEASE_VERSION` env var.

This PR also contains a refactor of the `deploy-vercel` action, removing
some code duplication and simplifying its usage locally through
`manual.mjs`.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/5988?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/5988?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5988)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
jprochazk authored Apr 17, 2024
1 parent 0585546 commit 7e0177c
Show file tree
Hide file tree
Showing 18 changed files with 450 additions and 399 deletions.
32 changes: 0 additions & 32 deletions .github/actions/deploy-vercel/index.mjs

This file was deleted.

48 changes: 0 additions & 48 deletions .github/actions/deploy-vercel/manual.mjs

This file was deleted.

49 changes: 0 additions & 49 deletions .github/actions/deploy-vercel/preview.mjs

This file was deleted.

68 changes: 0 additions & 68 deletions .github/actions/deploy-vercel/production.mjs

This file was deleted.

38 changes: 0 additions & 38 deletions .github/actions/deploy-vercel/test.mjs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,22 @@ inputs:
description: "Vercel project name to update and redeploy"
type: string
required: true
command:
description: "`deploy` or `update-env`"
type: string
required: true
release_commit:
description: "Release commit to update the deployment to"
type: string
required: true
required: false
release_version:
description: "Which release version to update the deployment to"
type: string
required: false
target:
description: "Which Vercel environment to deploy to"
type: string
required: true
required: false

runs:
using: "node20"
Expand Down
36 changes: 36 additions & 0 deletions .github/actions/vercel/commands/deploy-preview.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// @ts-check

import { setOutput } from "../util.mjs";
import { Client } from "../vercel.mjs";

/**
*
* @param {Client} client
* @param {{
* team: string;
* project: string;
* commit: string | null;
* version: string | null;
* }} options
*/
export async function deployToPreview(client, options) {
const project = await client.project(options.team, options.project);
const deployment = await project.latestProductionDeployment();

let line = `Deploying preview`;
if (options.commit) line += ` RELEASE_COMMIT=${options.commit}`;
if (options.version) line += ` RELEASE_VERSION=${options.version}`;
console.log(line);

const env = { IS_PR_PREVIEW: "true" };
if (options.commit) env["RELEASE_COMMIT"] = options.commit;
if (options.version) env["RELEASE_VERSION"] = options.version;

const { url } = await project.deployPreviewFrom(
deployment.uid,
"landing-preview",
env,
);

setOutput("vercel_preview_url", url);
}
23 changes: 23 additions & 0 deletions .github/actions/vercel/commands/deploy-production.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// @ts-check

import { Client } from "../vercel.mjs";

/**
*
* @param {Client} client
* @param {{
* team: string;
* project: string;
* commit: string | null;
* version: string | null;
* }} options
*/
export async function deployToProduction(client, options) {
const project = await client.project(options.team, options.project);
const deployment = await project.latestProductionDeployment();

if (options.commit) await project.setEnv("RELEASE_COMMIT", options.commit);
if (options.version) await project.setEnv("RELEASE_VERSION", options.version);

await project.redeploy(deployment.uid, "landing");
}
20 changes: 20 additions & 0 deletions .github/actions/vercel/commands/update-env.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @ts-check

import { Client } from "../vercel.mjs";

/**
*
* @param {Client} client
* @param {{
* team: string;
* project: string;
* commit: string | null;
* version: string | null;
* }} options
*/
export async function updateProjectEnv(client, options) {
const project = await client.project(options.team, options.project);

if (options.commit) await project.setEnv("RELEASE_COMMIT", options.commit);
if (options.version) await project.setEnv("RELEASE_VERSION", options.version);
}
Loading

0 comments on commit 7e0177c

Please sign in to comment.