-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.config.mjs
51 lines (45 loc) · 1.12 KB
/
release.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { execSync } from "node:child_process";
function isDryRun() {
return process.argv.includes("--dry-run");
}
function getLocalRepoUrl() {
const rootDir = execSync("git rev-parse --show-toplevel").toString().trim();
return `file://${rootDir}/.git`;
}
function getCurrentBranch() {
return execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
}
function getDryRunConfig() {
return {
repositoryUrl: getLocalRepoUrl(),
branches: [getCurrentBranch()],
preset: "conventionalcommits",
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
],
};
}
export default isDryRun()
? getDryRunConfig()
: {
branches: ["main"],
preset: "conventionalcommits",
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
npmPublish: false,
tarballDir: ".",
},
],
[
"@semantic-release/github",
{
assets: ["*.tgz"],
},
],
],
};