Skip to content

Commit

Permalink
Merge pull request #228 from silvolu/release-on-tag
Browse files Browse the repository at this point in the history
build: release on git tag
  • Loading branch information
silvolu committed Sep 19, 2014
2 parents a47cc9b + 695e719 commit fc15244
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions scripts/merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 40 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fc15244

Please sign in to comment.