-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (32 loc) · 1.18 KB
/
index.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
const {config} = require('dotenv');
const semanticRelease = require('semantic-release');
async function release() {
try {
config();
const result = await semanticRelease({
branches: [
'main',
],
noCi: true,
dryRun: process.env.DRY_RUN
}, {
// Pass the variable `MY_ENV_VAR` to semantic-release without having to modify the local `process.env`
env: {...process.env},
});
if (result) {
const {lastRelease, commits, nextRelease, releases} = result;
console.log(`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`);
if (lastRelease.version) {
console.log(`The last release was "${lastRelease.version}".`);
}
for (const release of releases) {
console.log(`The release was published with plugin "${release.pluginName}".`);
}
} else {
console.log('No release published.');
}
} catch (err) {
console.error('The automated release failed with %O', err)
}
}
void release();