This repository has been archived by the owner on May 21, 2020. It is now read-only.
forked from algolia/instantsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ship.config.js
76 lines (75 loc) · 2.11 KB
/
ship.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
/* eslint-disable import/no-commonjs */
const fs = require('fs');
const path = require('path');
module.exports = {
mergeStrategy: { toSameBranch: ['master', 'next'] },
shouldPrepare: ({ releaseType, commitNumbersPerType }) => {
const { fix = 0 } = commitNumbersPerType;
if (releaseType === 'patch' && fix === 0) {
return false;
}
return true;
},
versionUpdated: ({ version, dir }) => {
fs.writeFileSync(
path.resolve(dir, 'src', 'lib', 'version.ts'),
`export default '${version}';\n`
);
},
beforeCommitChanges: ({ exec }) => {
exec('yarn doctoc');
},
pullRequestTeamReviewer: ['instantsearch-for-websites'],
buildCommand: ({ version }) =>
`NODE_ENV=production VERSION=${version} yarn build`,
testCommandBeforeRelease: () => 'echo "No need to test again."',
afterPublish: ({ exec, version, releaseTag }) => {
if (releaseTag === 'latest' && version.startsWith('4.')) {
exec('./scripts/release/build-experimental-typescript.js');
exec(
`yarn publish --no-git-tag-version --non-interactive --tag experimental-typescript`
);
}
},
slack: {
// disable slack notification for `prepared` and `releaseStart` lifecycle.
// Ship.js will send slack message only for `releaseSuccess`.
prepared: null,
releaseStart: null,
releaseSuccess: ({
appName,
version,
tagName,
latestCommitHash,
latestCommitUrl,
repoURL,
}) => ({
pretext: [
`:tada: Successfully released *${appName}@${version}*`,
'',
`Make sure to run \`yarn run release-templates\` in \`create-instantsearch-app\`.`,
].join('\n'),
fields: [
{
title: 'Branch',
value: 'master',
short: true,
},
{
title: 'Commit',
value: `*<${latestCommitUrl}|${latestCommitHash}>*`,
short: true,
},
{
title: 'Version',
value: version,
short: true,
},
{
title: 'Release',
value: `${repoURL}/releases/tag/${tagName}`,
},
],
}),
},
};