Skip to content

Commit 8aa0a61

Browse files
committed
chore: 🔨 Improve release script
1 parent 6475cae commit 8aa0a61

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

scripts/release.ts

+52-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (status.stdout.length !== 0) {
1919
Deno.exit(1);
2020
}
2121

22-
info("Running tests");
22+
info("> Running tests");
2323

2424
if (
2525
!new Deno.Command("deno", {
@@ -32,6 +32,43 @@ if (
3232
Deno.exit(1);
3333
}
3434

35+
info("Tests passed");
36+
info("> Type-checking");
37+
if (
38+
!new Deno.Command("deno", {
39+
args: ["check", "**/*.ts"],
40+
stdout: "inherit",
41+
"stderr": "inherit",
42+
}).outputSync().success
43+
) {
44+
critical("Type-checking failed");
45+
Deno.exit(1);
46+
}
47+
info("Type-checking passed");
48+
info("> Linting");
49+
if (
50+
!new Deno.Command("deno", {
51+
args: ["lint"],
52+
stdout: "inherit",
53+
"stderr": "inherit",
54+
}).outputSync().success
55+
) {
56+
critical("Linting failed");
57+
Deno.exit(1);
58+
}
59+
info("Linting passed");
60+
info("> Linting Documentation");
61+
if (
62+
!new Deno.Command("deno", {
63+
args: ["doc", "--lint", "**/*.ts"],
64+
stdout: "inherit",
65+
"stderr": "inherit",
66+
}).outputSync().success
67+
) {
68+
critical("Linting Documentation failed");
69+
Deno.exit(1);
70+
}
71+
3572
const CURRENT_FILE = import.meta.url.replace("file://", "");
3673
Deno.chdir(resolve(CURRENT_FILE, "..", ".."));
3774

@@ -52,7 +89,7 @@ const newVersion = format(increment(parse(currentVersion), bump.releaseType));
5289

5390
info(`Bumping version from ${currentVersion} to ${newVersion}`);
5491

55-
info("Updating deno.json");
92+
info("> Updating deno.json");
5693

5794
Deno.writeTextFile(
5895
"./deno.json",
@@ -67,7 +104,7 @@ Deno.writeTextFile(
67104
);
68105

69106
info("Updated deno.json");
70-
info("Generating changelog");
107+
info("> Generating changelog");
71108

72109
const changelog = await new Promise<string>((resolve, reject) => {
73110
let data = "#";
@@ -93,6 +130,7 @@ const newChangelog = oldChangelog.replace(
93130
Deno.writeTextFile("./CHANGELOG.md", newChangelog);
94131

95132
info("Updated CHANGELOG.md");
133+
info("> Adding files to git");
96134
if (
97135
!new Deno.Command("git", {
98136
args: ["add", "deno.json", "CHANGELOG.md"],
@@ -106,6 +144,7 @@ if (
106144

107145
info("Added files to git");
108146

147+
info("> Committing changes");
109148
if (
110149
!new Deno.Command("git", {
111150
args: ["commit", "-m", `chore(release): Release v${newVersion} 🚀`],
@@ -118,10 +157,17 @@ if (
118157
}
119158

120159
info("Committed changes");
160+
info("> Tagging release");
121161

122162
if (
123163
!new Deno.Command("git", {
124-
args: ["tag", `v${newVersion}`],
164+
args: [
165+
"tag",
166+
"-a",
167+
`v${newVersion}`,
168+
"-m",
169+
changelog.split("\n").slice(1).join("\n"),
170+
],
125171
stdout: "inherit",
126172
"stderr": "inherit",
127173
}).outputSync().success
@@ -131,3 +177,5 @@ if (
131177
}
132178

133179
info("Tagged release");
180+
info("Release complete 🚀");
181+
info("Run `git push --follow-tags` to push changes to the remote repository");

0 commit comments

Comments
 (0)