-
-
Notifications
You must be signed in to change notification settings - Fork 181
/
version.js
30 lines (25 loc) · 742 Bytes
/
version.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
const { execSync } = require('child_process');
const package = require('./package.json');
function getCurrentCommit() {
const commit = execSync('git rev-parse HEAD').toString().trim();
return commit;
}
function getNextVersion() {
return package.exNextVersion;
}
function getAlphaVersion() {
let commit = getCurrentCommit();
let version = getNextVersion();
if (process.env.GITHUB_RUN_NUMBER) {
return version + '-alpha.' + process.env.GITHUB_RUN_NUMBER + '+' + commit.substring(0, 7);
} else {
return version + '-alpha.0' + '+' + commit.substring(0, 7);
}
}
function getReleaseVersion() {
return package.version;
}
module.exports = {
getAlphaVersion: getAlphaVersion,
getReleaseVersion: getReleaseVersion
};