Commit 15f13c84 authored by yogevbd's avatar yogevbd

Update release script

parent 657214d7
...@@ -8,7 +8,7 @@ const path = require('path'); ...@@ -8,7 +8,7 @@ const path = require('path');
// Workaround JS // Workaround JS
const isRelease = process.env.RELEASE_BUILD === 'true'; const isRelease = process.env.RELEASE_BUILD === 'true';
const ONLY_ON_BRANCH = 'origin/master'; const BRANCH = process.env.BRANCH;
const VERSION_TAG = isRelease ? 'latest' : 'snapshot'; const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
const VERSION_INC = 'patch'; const VERSION_INC = 'patch';
...@@ -31,7 +31,7 @@ function validateEnv() { ...@@ -31,7 +31,7 @@ function validateEnv() {
return false; return false;
} }
if (process.env.GIT_BRANCH !== ONLY_ON_BRANCH) { if (process.env.GIT_BRANCH !== BRANCH) {
console.log(`not publishing on branch ${process.env.GIT_BRANCH}`); console.log(`not publishing on branch ${process.env.GIT_BRANCH}`);
return false; return false;
} }
...@@ -121,13 +121,13 @@ function readPackageJson() { ...@@ -121,13 +121,13 @@ function readPackageJson() {
} }
function updatePackageJsonGit(version) { function updatePackageJsonGit(version) {
exec.execSync(`git checkout master`); exec.execSync(`git checkout ${BRANCH}`);
const packageJson = readPackageJson(); const packageJson = readPackageJson();
packageJson.version = version; packageJson.version = version;
writePackageJson(packageJson); writePackageJson(packageJson);
exec.execSync(`git add package.json`); exec.execSync(`git add package.json`);
exec.execSync(`git commit -m"Update package.json version to ${version} [ci skip]"`); exec.execSync(`git commit -m"Update package.json version to ${version} [ci skip]"`);
exec.execSync(`git push deploy master`); exec.execSync(`git push deploy ${BRANCH}`);
} }
run(); run();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment