@@ -24,12 +24,20 @@ npm run system-test
24
24
git config --global user.name " travis-ci"
25
25
git config --global user.email
" [email protected] "
26
26
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
+
27
35
# # Attempt to update docs/manifest.json with the new version.
28
36
git submodule add -f -b master https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} master
29
37
cd master
30
38
node -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 } ')
33
41
require('fs').writeFileSync('docs/manifest.json', JSON.stringify(file, null, 2) + '\n')
34
42
"
35
43
# allow "git add" to fail if there aren't new files.
@@ -47,15 +55,15 @@ cd ../
47
55
48
56
# # Upload the docs to gh-pages.
49
57
git 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}
52
61
npm run bundle
53
- cp -R ghpages/json/google-cloud/master ghpages/json/google-cloud/${TRAVIS_TAG}
54
62
cp docs/home.html ghpages/json
55
63
cp docs/manifest.json ghpages
56
64
cd ghpages
57
65
git add json
58
66
git add manifest.json
59
- git commit -m " Update docs for ${TRAVIS_TAG } "
67
+ git commit -m " Update docs for ${MODULE_NAME} ${MODULE_VERSION }"
60
68
git status
61
69
git push https://${GH_OAUTH_TOKEN} @github.com/${GH_OWNER} /${GH_PROJECT_NAME} HEAD:gh-pages
0 commit comments