Browse Source

Update release script

yogevbd 5 years ago
parent
commit
e192e31231
1 changed files with 3 additions and 8 deletions
  1. 3
    8
      scripts/release.js

+ 3
- 8
scripts/release.js View File

8
 // Workaround JS
8
 // Workaround JS
9
 const isRelease = process.env.RELEASE_BUILD === 'true';
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
 const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
12
 const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
13
 const VERSION_INC = 'patch';
13
 const VERSION_INC = 'patch';
14
 
14
 
31
         return false;
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
     return true;
34
     return true;
40
 }
35
 }
41
 
36
 
121
 }
116
 }
122
 
117
 
123
 function updatePackageJsonGit(version) {
118
 function updatePackageJsonGit(version) {
124
-    exec.execSync(`git checkout master`);
119
+    exec.execSync(`git checkout ${BRANCH}`);
125
     const packageJson = readPackageJson();
120
     const packageJson = readPackageJson();
126
     packageJson.version = version;
121
     packageJson.version = version;
127
     writePackageJson(packageJson);
122
     writePackageJson(packageJson);
128
     exec.execSync(`git add package.json`);
123
     exec.execSync(`git add package.json`);
129
     exec.execSync(`git commit -m"Update package.json version to ${version} [ci skip]"`);
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
 run();
128
 run();