-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.config.js
67 lines (63 loc) · 1.75 KB
/
release.config.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const mainConfig = {
branches: ["main", { name: "develop", channel: "beta", prerelease: "beta" }],
repositoryUrl: "https://github.com/mission-apprentissage/cerfa.git",
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
},
],
"@semantic-release/npm",
[
"@semantic-release/exec",
{
prepareCmd: "./scripts/prepare-release.sh ${nextRelease.version}",
},
],
[
"@semantic-release/git",
{
assets: ["ui/package.json", "server/package.json", "ui/CHANGELOG.md", "CHANGELOG.md", "package.json"],
message:
// eslint-disable-next-line no-template-curly-in-string
"chore(release): bump ${nextRelease.version}",
},
],
"@semantic-release/github",
[
"@semantic-release/exec",
{
publishCmd: "git checkout -- package.json",
},
],
[
"semantic-release-slack-bot",
{
notifyOnSuccess: true,
notifyOnFail: true,
markdownReleaseNotes: true,
},
],
],
};
const { execSync } = require("child_process");
const { createHash } = require("crypto");
const branch = execSync("git branch --show-current").toString().trimEnd("\n");
const channel = createHash("md5").update(branch).digest("hex");
const localConfig = {
branches: [
"main",
{ name: "develop", channel: "beta", prerelease: "beta" },
{
name: branch,
channel,
prerelease: channel,
},
],
repositoryUrl: "https://github.com/mission-apprentissage/cerfa.git",
plugins: ["@semantic-release/commit-analyzer"],
};
module.exports = process.env.LOCAL_RELEASE ? localConfig : mainConfig;