Skip to content

Commit

Permalink
Add check to publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Aug 6, 2024
1 parent 19e5044 commit a1b88bf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion resources/scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ const chalk = require("chalk");

const BUILD_DIR = resolve(__dirname, "../../build");
const DIST_DIR = resolve(__dirname, "../../dist");
const EXPECTED_ENV_VARS = [
"APPLE_ID",
"APPLE_APP_SPECIFIC_PASSWORD",
"APPLE_TEAM_ID",
"GH_TOKEN",
"WIN_YUBIKEY_PIN"
];

async function buildApp() {
console.log("Building...");
Expand All @@ -29,6 +36,14 @@ async function buildBundle() {
}
}

async function check() {
for (const envVar of EXPECTED_ENV_VARS) {
if (typeof process.env[envVar] !== "string") {
throw new Error(`Environment variable not set: ${envVar}`);
}
}
}

async function clean() {
console.log("Cleaning...");
await rimraf(BUILD_DIR);
Expand All @@ -42,7 +57,7 @@ async function routine(...callbacks) {
}
}

routine(clean, buildApp, buildBundle)
routine(check, clean, buildApp, buildBundle)
.then(() => {
console.log("Done.");
})
Expand Down
2 changes: 1 addition & 1 deletion source/main/library/build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file updated automatically: changes made here will be overwritten!

export const VERSION = "2.28.0-6";
export const VERSION = "2.28.0-7";

0 comments on commit a1b88bf

Please sign in to comment.