Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: individual package support #1479

Merged
merged 10 commits into from
Aug 11, 2016
20 changes: 14 additions & 6 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ npm run system-test
git config --global user.name "travis-ci"
git config --global user.email "travis@travis-ci.org"

if [[ ${TRAVIS_TAG} == *"-"* ]]; then

This comment was marked as spam.

MODULE_NAME=${TRAVIS_TAG%-*}
MODULE_VERSION=${TRAVIS_TAG##*-}
else
MODULE_NAME="google-cloud"
MODULE_VERSION=${TRAVIS_TAG}
fi

## Attempt to update docs/manifest.json with the new version.
git submodule add -f -b master https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} master
cd master
node -e "
module = require('./docs/manifest.json').modules[0]
if (module.versions.indexOf('${TRAVIS_TAG}') === -1) module.versions.unshift('${TRAVIS_TAG}')
module = require('./docs/manifest.json').modules.filter(function(mod) { return mod.id === '${MODULE_NAME}'; })[0];
if (module.versions.indexOf('${MODULE_VERSION}') === -1) module.versions.unshift('${MODULE_VERSION}')
require('fs').writeFileSync('docs/manifest.json', JSON.stringify(file, null, 2) + '\n')
"
# allow "git add" to fail if there aren't new files.
Expand All @@ -47,15 +55,15 @@ cd ../

## Upload the docs to gh-pages.
git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages
test -d "ghpages/json/google-cloud/${TRAVIS_TAG}" && exit 0 || mkdir ghpages/json/google-cloud/${TRAVIS_TAG}
cp docs/*.md ghpages/json/google-cloud/${TRAVIS_TAG}
test -d "ghpages/json/${MODULE_NAME}/${MODULE_VERSION}" && exit 0 || mkdir ghpages/json/${MODULE_NAME}/${MODULE_VERSION}
cp docs/*.md ghpages/json/${MODULE_NAME}/${MODULE_VERSION}
cp -R docs/json/${MODULE_NAME}/master/* ghpages/json/${MODULE_NAME}/${MODULE_VERSION}
npm run bundle
cp -R ghpages/json/google-cloud/master ghpages/json/google-cloud/${TRAVIS_TAG}
cp docs/home.html ghpages/json
cp docs/manifest.json ghpages
cd ghpages
git add json
git add manifest.json
git commit -m "Update docs for ${TRAVIS_TAG}"
git commit -m "Update docs for ${MODULE_NAME} ${MODULE_VERSION}"
git status
git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages