Skip to content

Commit

Permalink
add manual deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
jprochazk committed Nov 1, 2023
1 parent 676f8b9 commit 2fb8dc9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/actions/deploy-vercel/manual.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env node

// Manually run the deployment:
//
// node manual.mjs \
// --token VERCEL_TOKEN \
// --team rerun \
// --project landing \
// --commit RELEASE_COMMIT
//

import { execSync } from "node:child_process";
import { parseArgs } from "node:util";
import { fileURLToPath } from "node:url";
import path from "node:path";
import { assert } from "./util.mjs";

const dirname = path.dirname(fileURLToPath(import.meta.url));

/** @type {typeof execSync} */
const $ = (cmd, opts) => execSync(cmd, { stdio: "inherit", ...opts });

const { token, team, project, commit } = parseArgs({
options: {
token: { type: "string" },
team: { type: "string" },
project: { type: "string" },
commit: { type: "string" },
},
strict: true,
allowPositionals: false,
}).values;
assert(token, "missing `--token`");
assert(team, "missing `--team`");
assert(project, "missing `--project`");
assert(commit, "missing `--commit`");

$("node index.mjs", {
cwd: dirname,
env: {
...process.env,
INPUT_VERCEL_TOKEN: token,
INPUT_VERCEL_TEAM_NAME: team,
INPUT_VERCEL_PROJECT_NAME: project,
INPUT_RELEASE_COMMIT: commit,
},
});

1 change: 0 additions & 1 deletion .github/actions/deploy-vercel/util.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export function info(strings, ...values) {
* @returns {string | null}
*/
export function getInput(name) {
// @ts-expect-error: `process` is not defined without the right type definitions
return process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] ?? null;
}

Expand Down

0 comments on commit 2fb8dc9

Please sign in to comment.