Skip to content

Commit d467a31

Browse files
committed
ci(release): check that lint, test and docs:build run without error before releasing
1 parent eabc017 commit d467a31

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

scripts/release.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { execa } from "execa";
66
// --- Configuration ---
77
const CHANGELOG_PATH = path.resolve(process.cwd(), "CHANGELOG.md");
88
const DRY_RUN = process.argv.includes("--dry-run");
9+
const SKIP_BUILDTEST = process.argv.includes("--skip-buildtest");
910

1011
// --- Helper Functions ---
1112
const log = {
@@ -81,6 +82,21 @@ async function checkPrerequisites() {
8182
log.success("Prerequisites met.");
8283
}
8384

85+
async function buildTest() {
86+
log.info("Running tests and building documentation...");
87+
try {
88+
await run("pnpm", ["lint"]);
89+
await run("pnpm", ["test"]);
90+
await run("pnpm", ["docs:build"]);
91+
} catch (error) {
92+
log.error("Tests or documentation build failed.");
93+
console.error(error);
94+
process.exit(1);
95+
}
96+
97+
log.success("Tests and documentation build completed successfully.");
98+
}
99+
84100
// --- Main Script ---
85101
async function main() {
86102
log.info("Starting release process...");
@@ -89,6 +105,12 @@ async function main() {
89105
}
90106

91107
await checkPrerequisites();
108+
if (SKIP_BUILDTEST) {
109+
log.info("Skipping build tests.");
110+
} else {
111+
log.info("Starting build tests.");
112+
await buildTest();
113+
}
92114

93115
// 1. Run changelogen to bump version and update changelog
94116
log.info("Bumping version and generating changelog with changelogen...");

0 commit comments

Comments
 (0)