@@ -24,12 +24,20 @@ npm run system-test
2424git config --global user.name " travis-ci"
2525git config --global user.email
" [email protected] " 2626
27+ if [[ ${TRAVIS_TAG} == * " -" * ]]; then
28+ MODULE_NAME=${TRAVIS_TAG% -* }
29+ MODULE_VERSION=${TRAVIS_TAG##* -}
30+ else
31+ MODULE_NAME=" google-cloud"
32+ MODULE_VERSION=${TRAVIS_TAG}
33+ fi
34+
2735# # Attempt to update docs/manifest.json with the new version.
2836git submodule add -f -b master https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} master
2937cd master
3038node -e "
31- module = require('./docs/manifest.json').modules[0]
32- if (module.versions.indexOf('${TRAVIS_TAG } ') === -1) module.versions.unshift('${TRAVIS_TAG } ')
39+ module = require('./docs/manifest.json').modules.filter(function(mod) { return mod.id === ' ${MODULE_NAME} '; }) [0];
40+ if (module.versions.indexOf('${MODULE_VERSION } ') === -1) module.versions.unshift('${MODULE_VERSION } ')
3341require('fs').writeFileSync('docs/manifest.json', JSON.stringify(file, null, 2) + '\n')
3442"
3543# allow "git add" to fail if there aren't new files.
@@ -47,15 +55,15 @@ cd ../
4755
4856# # Upload the docs to gh-pages.
4957git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} ghpages
50- test -d " ghpages/json/google-cloud/${TRAVIS_TAG} " && exit 0 || mkdir ghpages/json/google-cloud/${TRAVIS_TAG}
51- cp docs/* .md ghpages/json/google-cloud/${TRAVIS_TAG}
58+ test -d " ghpages/json/${MODULE_NAME} /${MODULE_VERSION} " && exit 0 || mkdir ghpages/json/${MODULE_NAME} /${MODULE_VERSION}
59+ cp docs/* .md ghpages/json/${MODULE_NAME} /${MODULE_VERSION}
60+ cp -R docs/json/${MODULE_NAME} /master/* ghpages/json/${MODULE_NAME} /${MODULE_VERSION}
5261npm run bundle
53- cp -R ghpages/json/google-cloud/master ghpages/json/google-cloud/${TRAVIS_TAG}
5462cp docs/home.html ghpages/json
5563cp docs/manifest.json ghpages
5664cd ghpages
5765git add json
5866git add manifest.json
59- git commit -m " Update docs for ${TRAVIS_TAG } "
67+ git commit -m " Update docs for ${MODULE_NAME} ${MODULE_VERSION }"
6068git status
6169git push https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} HEAD:gh-pages
0 commit comments