|
@@ -8,7 +8,7 @@ const path = require('path');
|
8
|
8
|
// Workaround JS
|
9
|
9
|
const isRelease = process.env.RELEASE_BUILD === 'true';
|
10
|
10
|
|
11
|
|
-const ONLY_ON_BRANCH = 'origin/master';
|
|
11
|
+const BRANCH = process.env.GIT_BRANCH;
|
12
|
12
|
const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
|
13
|
13
|
const VERSION_INC = 'patch';
|
14
|
14
|
|
|
@@ -31,11 +31,6 @@ function validateEnv() {
|
31
|
31
|
return false;
|
32
|
32
|
}
|
33
|
33
|
|
34
|
|
- if (process.env.GIT_BRANCH !== ONLY_ON_BRANCH) {
|
35
|
|
- console.log(`not publishing on branch ${process.env.GIT_BRANCH}`);
|
36
|
|
- return false;
|
37
|
|
- }
|
38
|
|
-
|
39
|
34
|
return true;
|
40
|
35
|
}
|
41
|
36
|
|
|
@@ -121,13 +116,13 @@ function readPackageJson() {
|
121
|
116
|
}
|
122
|
117
|
|
123
|
118
|
function updatePackageJsonGit(version) {
|
124
|
|
- exec.execSync(`git checkout master`);
|
|
119
|
+ exec.execSync(`git checkout ${BRANCH}`);
|
125
|
120
|
const packageJson = readPackageJson();
|
126
|
121
|
packageJson.version = version;
|
127
|
122
|
writePackageJson(packageJson);
|
128
|
123
|
exec.execSync(`git add package.json`);
|
129
|
124
|
exec.execSync(`git commit -m"Update package.json version to ${version} [ci skip]"`);
|
130
|
|
- exec.execSync(`git push deploy master`);
|
|
125
|
+ exec.execSync(`git push deploy ${BRANCH}`);
|
131
|
126
|
}
|
132
|
127
|
|
133
|
128
|
run();
|