Browse Source

Change release script and versioning

Shalom Yerushalmy 6 years ago
parent
commit
209d74ce74
1 changed files with 4 additions and 7 deletions
  1. 4
    7
      scripts/release.js

+ 4
- 7
scripts/release.js View File

4
 const fs = require('fs');
4
 const fs = require('fs');
5
 const _ = require('lodash');
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
 const VERSION_INC = 'patch';
9
 const VERSION_INC = 'patch';
10
 
10
 
11
 function run() {
11
 function run() {
54
 }
54
 }
55
 
55
 
56
 function versionTagAndPublish() {
56
 function versionTagAndPublish() {
57
-  const packageVersion = semver.clean(process.env.npm_package_version);
58
-  console.log(`package version: ${packageVersion}`);
59
-
60
   const currentPublished = findCurrentPublishedVersion();
57
   const currentPublished = findCurrentPublishedVersion();
61
   console.log(`current published version: ${currentPublished}`);
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
   tryPublishAndTag(version);
61
   tryPublishAndTag(version);
65
 }
62
 }
66
 
63
 
67
 function findCurrentPublishedVersion() {
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
 function tryPublishAndTag(version) {
68
 function tryPublishAndTag(version) {