|
@@ -4,8 +4,8 @@ const semver = require('semver');
|
4
|
4
|
const fs = require('fs');
|
5
|
5
|
const _ = require('lodash');
|
6
|
6
|
|
7
|
|
-const ONLY_ON_BRANCH = 'origin/v2';
|
8
|
|
-const VERSION_TAG = 'alpha';
|
|
7
|
+const ONLY_ON_BRANCH = 'origin/master';
|
|
8
|
+const VERSION_TAG = process.env.RELEASE_BUILD ? 'latest' : 'snapshot';
|
9
|
9
|
const VERSION_INC = 'patch';
|
10
|
10
|
|
11
|
11
|
function run() {
|
|
@@ -54,18 +54,15 @@ email=\${NPM_EMAIL}
|
54
|
54
|
}
|
55
|
55
|
|
56
|
56
|
function versionTagAndPublish() {
|
57
|
|
- const packageVersion = semver.clean(process.env.npm_package_version);
|
58
|
|
- console.log(`package version: ${packageVersion}`);
|
59
|
|
-
|
60
|
57
|
const currentPublished = findCurrentPublishedVersion();
|
61
|
58
|
console.log(`current published version: ${currentPublished}`);
|
62
|
59
|
|
63
|
|
- const version = semver.gt(packageVersion, currentPublished) ? packageVersion : semver.inc(currentPublished, VERSION_INC);
|
|
60
|
+ const version = process.env.RELEASE_BUILD ? process.env.VERSION : `${currentPublished}-snapshot.${process.env.BUILD_ID}`;
|
64
|
61
|
tryPublishAndTag(version);
|
65
|
62
|
}
|
66
|
63
|
|
67
|
64
|
function findCurrentPublishedVersion() {
|
68
|
|
- return exec.execSyncRead(`npm view ${process.env.npm_package_name} dist-tags.${VERSION_TAG}`);
|
|
65
|
+ return exec.execSyncRead(`npm view ${process.env.npm_package_name} dist-tags.latest`);
|
69
|
66
|
}
|
70
|
67
|
|
71
|
68
|
function tryPublishAndTag(version) {
|