From 388612414cdd33dd2a67daaabd40bf75b89f2efe Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Thu, 11 May 2017 11:43:19 +0300 Subject: [PATCH] Update Travis CI Scripts Set `rc` tag to the publishConfig section for the release branch. --- .travis.yml | 9 ++++++++- .travis/add-publishConfig.js | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 795bfd9141..71e3295d54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ after_success: - mkdir s3-publish - cp nativescript*.tgz s3-publish/nativescript.tgz before_deploy: -- node .travis/add-publishConfig.js next +- node .travis/add-publishConfig.js $TRAVIS_BRANCH deploy: - provider: s3 bucket: nativescript-ci @@ -43,3 +43,10 @@ deploy: branch: master api_key: secure: KzzsvF3eA3j4gRQa8tO//+XWNSR3XiX8Sa18o3PyKyG9/cBZ6PQ3Te74cNS1C3ZiLUOgs5dWA6/TmRVPci4XjvFaWo/B6e2fuVSl5H94Od99bkeBHJsbLSEkLN4ClV/YbGuyKgA5Q2yIFt6p2EJjL90RjbbIk7I4YuyG2Mo3j0Q= + - provider: npm + skip_cleanup: true + email: nativescript@telerik.com + on: + branch: release + api_key: + secure: KzzsvF3eA3j4gRQa8tO//+XWNSR3XiX8Sa18o3PyKyG9/cBZ6PQ3Te74cNS1C3ZiLUOgs5dWA6/TmRVPci4XjvFaWo/B6e2fuVSl5H94Od99bkeBHJsbLSEkLN4ClV/YbGuyKgA5Q2yIFt6p2EJjL90RjbbIk7I4YuyG2Mo3j0Q= diff --git a/.travis/add-publishConfig.js b/.travis/add-publishConfig.js index c6e3c6334b..e11c0dd434 100644 --- a/.travis/add-publishConfig.js +++ b/.travis/add-publishConfig.js @@ -1,25 +1,25 @@ #!/usr/bin/env node -var fsModule = require('fs'); +var fsModule = require("fs"); -//Adds a publishConfig section to the package.json file +// Adds a publishConfig section to the package.json file // and sets a tag to it -var path = './package.json'; +var path = "./package.json"; var fileOptions = {encoding: "utf-8"}; var content = fsModule.readFileSync(path, fileOptions); -var tag = process.argv[2]; -if (!tag) { - console.log('Please pass the tag name as an argument!'); - process.exit(1); -} - var packageDef = JSON.parse(content); if (!packageDef.publishConfig) { packageDef.publishConfig = {}; } -packageDef.publishConfig.tag = tag; -var newContent = JSON.stringify(packageDef, null, ' '); -fsModule.writeFileSync(path, newContent, fileOptions); \ No newline at end of file +var branch = process.argv[2]; +if (!branch) { + console.log("Please pass the branch name as an argument!"); + process.exit(1); +} +packageDef.publishConfig.tag = branch === "release" ? "rc" : "next"; + +var newContent = JSON.stringify(packageDef, null, " "); +fsModule.writeFileSync(path, newContent, fileOptions);