Browse Source

update release script, publish v2 as 2.0.0 alpha

Daniel Zlotin 7 years ago
parent
commit
0a16f4b58d
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      scripts/release.js

+ 7
- 6
scripts/release.js View File

@@ -4,21 +4,22 @@ const p = require('path');
4 4
 const semver = require('semver');
5 5
 const fs = require('fs');
6 6
 
7
+const ONLY_ON_BRANCH = 'v2';
7 8
 const VERSION_TAG = 'alpha';
8
-const VERSION_INC = 'prerelease';
9
+const VERSION_INC = 'patch';
9 10
 
10 11
 function validateEnv() {
11 12
   if (!process.env.CI || !process.env.TRAVIS) {
12 13
     throw new Error(`releasing is only available from Travis CI`);
13 14
   }
14 15
 
15
-  if (process.env.TRAVIS_BRANCH !== 'master') {
16
-    console.log(`not publishing on branch ${process.env.TRAVIS_BRANCH}`);
16
+  if (process.env.TRAVIS_PULL_REQUEST !== 'false') {
17
+    console.log(`not publishing as triggered by pull request ${process.env.TRAVIS_PULL_REQUEST}`);
17 18
     return false;
18 19
   }
19 20
 
20
-  if (process.env.TRAVIS_PULL_REQUEST !== 'false') {
21
-    console.log(`not publishing as triggered by pull request ${process.env.TRAVIS_PULL_REQUEST}`);
21
+  if (process.env.TRAVIS_BRANCH !== ONLY_ON_BRANCH) {
22
+    console.log(`not publishing on branch ${process.env.TRAVIS_BRANCH}`);
22 23
     return false;
23 24
   }
24 25
 
@@ -31,7 +32,7 @@ function setupGit() {
31 32
   exec.execSyncSilent(`git config --global user.name "${process.env.GIT_USER}"`);
32 33
   const remoteUrl = new RegExp(`https?://(\\S+)`).exec(exec.execSyncRead(`git remote -v`))[1];
33 34
   exec.execSyncSilent(`git remote add deploy "https://${process.env.GIT_USER}:${process.env.GIT_TOKEN}@${remoteUrl}"`);
34
-  exec.execSync(`git checkout master`);
35
+  exec.execSync(`git checkout ${ONLY_ON_BRANCH}`);
35 36
 }
36 37
 
37 38
 function calcNewVersion() {