Browse Source

auto publish from travis

Daniel Zlotin 7 years ago
parent
commit
1b6dace871
3 changed files with 17 additions and 18 deletions
  1. 12
    5
      .travis.yml
  2. 1
    1
      package.json
  3. 4
    12
      scripts/release.js

+ 12
- 5
.travis.yml View File

@@ -6,6 +6,7 @@ jdk:
6 6
 env:
7 7
   global:
8 8
     - NODE_VERSION=stable
9
+    - PATH=$PATH:$HOME/.yarn/bin
9 10
     - ANDROID_HOME=$HOME/android-sdk-linux
10 11
     - PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
11 12
 
@@ -17,8 +18,8 @@ branches:
17 18
   - master
18 19
 
19 20
 cache:
21
+  yarn: true
20 22
   directories:
21
-    - $HOME/.yarn-cache
22 23
     - $HOME/.gradle/
23 24
     - $HOME/.m2
24 25
     - $ANDROID_HOME/licenses/
@@ -29,18 +30,24 @@ before_cache:
29 30
 
30 31
 before_install:
31 32
   - set -e
32
-  - ./scripts/clean.sh
33
+  - nvm install $NODE_VERSION
34
+  - curl -o- -L https://yarnpkg.com/install.sh | bash
33 35
 
34 36
 install:
35
-  - nvm install $NODE_VERSION
36
-  - npm i -g yarn
37
-  - yarn
37
+  - ./scripts/clean.sh
38
+  - yarn install
38 39
 
39 40
 script:
40 41
   - yarn run lint
41 42
   - yarn run test:js
42 43
   - ./scripts/installAndroidSDK.sh
43 44
   - yarn run test:android
45
+  - yarn run release
44 46
 
45 47
 after_script:
46 48
   - echo "BUILD FINISHED"
49
+
50
+notifications:
51
+  email: false
52
+  slack:
53
+    secure: ISBdKzsYD4eas+wxLkNTFrXreWome0YmGATqgAS1R3BcZ+ZhUgZUgC9j52Ix9JUpNN52xCZ131Wbihu8w0RpuvNogFsl64q0tBplmpNfghT1EAO85w7ZBgHpAi1fxsxUSLlO5fCKv4kX84yksyG7mBxr9tR97gVDl3chWqEUCh1Wd+dx+R0RkJpTQ+VmME5Jmywr2F1Lv1TlxGXs4yN8wlnix/V6ebYSI1qwAWjAk8nHPIGdYxNivcwkmzenkbQuHAZpI6uxWJ+Hpx+wn69sZXarXVg3M20A8dv6DiWsd7gZUQaeX+gJa1HrAxjjEl6fiJZC9Zuq1aZmMAy0EHBIN4EuRpPgDG5CzEE9/yfHEBvXbKDF2Uk2aLN3LHY+7Q8SAL6ckGJ9eSp0fu68SFYUq4YoyV1jAx7/1teWzFORSEPx/1kDYoUSqhyIojcC0FcLVvY77Ij23cN3bR+hY4mLeuyajHjl6pm5jS+iiiJgM55+H9mP+v1XhLj/Me+giDP1bBqvfL4BshwXElZ5pjEeUMnEEbfMQkHUpQ5c9/PZVrIuNal4JUYi649wVUltoan9Zm8s4AkX2p0aY5ZMy0gel2ADeyGUk+u262Jt17k31nzcpGwAXSAYNdFHJCnga8kHn2eKYPO76qpb4JlOH1kQ33oNIur9/MYvx8CeZdJBd64=

+ 1
- 1
package.json View File

@@ -27,7 +27,7 @@
27 27
     "pretest": "npm run lint",
28 28
     "test": "npm run test:js && npm run test:android && npm run test:ios",
29 29
     "test:watch": "jest --coverage --watch",
30
-    "release": "npm version prerelease && npm publish --tag next && npm view react-native-navigation dist-tags && git push"
30
+    "release": "node ./scripts/release.js"
31 31
   },
32 32
   "optionalDependencies": {
33 33
     "react-redux": "*"

+ 4
- 12
scripts/release.js View File

@@ -42,16 +42,9 @@ function setupGit() {
42 42
 }
43 43
 
44 44
 function calcNewVersion() {
45
-  const latestVersion = execSyncRead(`npm view ${process.env.npm_package_name}@next version`);
46
-  console.log(`latest version is: ${latestVersion}`);
47
-  const packageJsonVersion = process.env.npm_package_version;
48
-  console.log(`package.json version is: ${packageJsonVersion}`);
49
-  const diff = semver.diff(packageJsonVersion, latestVersion);
50
-  if (diff === 'major' || diff === 'minor') {
51
-    return packageJsonVersion;
52
-  } else {
53
-    return semver.inc(latestVersion, 'patch');
54
-  }
45
+  const nextTaggedVersion = execSyncRead(`npm view ${process.env.npm_package_name}@next version`);
46
+  console.log(`next tagged version is: ${nextTaggedVersion}`);
47
+  return semver.inc(nextTaggedVersion, 'prerelease');
55 48
 }
56 49
 
57 50
 function copyNpmRc() {
@@ -63,7 +56,7 @@ function tagAndPublish(newVersion) {
63 56
   console.log(`new version is: ${newVersion}`);
64 57
   execSync(`npm version ${newVersion} -m "v${newVersion} [ci skip]"`);
65 58
   execSyncSilently(`git push deploy --tags`);
66
-  execSync(`npm publish`);
59
+  execSync(`npm publish --tag next`);
67 60
 }
68 61
 
69 62
 function run() {
@@ -76,4 +69,3 @@ function run() {
76 69
 }
77 70
 
78 71
 run();
79
-