diff --git a/.travis.yml b/.travis.yml index 3c43ca2611c..baaaeb8a7a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,3 +5,13 @@ script: - npm run lint - npm run test after_success: ./scripts/merge.sh +before_deploy: ./scripts/release.sh +deploy: + provider: npm + email: silvano.luciani@gmail.com + api_key: + secure: W8J++FLVJYKeZL9R5R/tpBJbmaVhYRyjiYDCAFg+HCaX/aa9THql7iYpTlk5ezQw3CXAqPZhWqvoxQMUJNFiAkdmsNhiopD7zInomCzQhlCazWqGsv0a/m5qfdlhlesv31/WZzqr+gA3PEOjG6ED893YMhDi8SluMfHZYbYJPXk= + on: + tags: true + repo: GoogleCloudPlatform/gcloud-node + all_branches: true diff --git a/scripts/merge.sh b/scripts/merge.sh index 6d35a4a453e..c6601256b4b 100755 --- a/scripts/merge.sh +++ b/scripts/merge.sh @@ -20,4 +20,17 @@ set -ev if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then openssl aes-256-cbc -K $encrypted_b8aa0887832a_key -iv $encrypted_b8aa0887832a_iv -in key.json.enc -out key.json -d npm run regression-test + + # generate new set of json files in docs/json/master + npm run docs + git submodule add -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages + # copy all the docs file that might have changed, excluding versions.txt (to avoid overriding it) + cd docs + cp -R `ls --ignore 'versions.txt'` ../ghpages/ + cd ../ghpages + git add . + # commit to gh-pages branch to apply changes + git config user.name "selfiebot" + git commit -m "Update docs after merge to master" + git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages fi diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 00000000000..dba9018fc7d --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ev + +# decrypt credentials +openssl aes-256-cbc -K $encrypted_b8aa0887832a_key -iv $encrypted_b8aa0887832a_iv -in key.json.enc -out key.json -d + +# create new coverage report +npm run coveralls + +### Update docs +# generate new set of json files in docs/json/master +npm run docs +git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages +# copy set of json to tag folder +mkdir ghpages/json/${TRAVIS_TAG} +cp -R docs/json/master/* ghpages/json/${TRAVIS_TAG} +cd ghpages +git add json/${TRAVIS_TAG} +# add new tag to versions +echo "${TRAVIS_TAG}" >> versions.txt +git add versions.txt +# commit to gh-pages branch +git config user.name "selfiebot" +git commit -m "Update docs for ${TRAVIS_TAG}" +git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages