This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
/
release.config.js
78 lines (74 loc) · 1.9 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
68
69
70
71
72
73
74
75
76
77
78
const mainConfig = {
branches: [
'master',
{ name: 'develop', channel: 'beta', prerelease: 'beta' },
],
repositoryUrl: 'https://github.com/nugit/datetime-utils.git',
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalcommits',
},
],
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogFile: 'CHANGELOG.md',
},
],
'@semantic-release/npm',
[
'@semantic-release/git',
{
assets: ['CHANGELOG.md', 'package.json'],
// eslint-disable-next-line no-template-curly-in-string
message: 'chore(release): ${nextRelease.version}',
},
],
[
'@semantic-release/github', {
assets: [
{ path: 'lib/nugit-datetime-utils.cjs.js', label: 'Common JS build' },
{ path: 'lib/nugit-datetime-utils.esm.js', label: 'ESM build' },
{ path: 'lib/nugit-datetime-utils.umd.js', label: 'UMD build' },
],
},
],
[
'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 = `alpha.${createHash('md5').update(branch).digest('hex')}`;
const localConfig = {
branches: [
'master',
{ name: 'develop', channel: 'beta', prerelease: 'beta' },
{
name: branch,
channel,
prerelease: channel,
},
],
repositoryUrl: 'https://github.com/nugit/datetime-utils.git',
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalcommits',
},
],
'@semantic-release/npm',
],
};
module.exports = process.env.LOCAL_RELEASE ? localConfig : mainConfig;