Skip to content

Commit

Permalink
Prevent multiple commits of docs in gh-pages branch (#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischah authored and SBoudrias committed Nov 9, 2016
1 parent 2c34bde commit 87b210b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
- SOURCE_BRANCH: master
- TARGET_BRANCH: gh-pages
- DOCS_DIR: "../yeoman-generator-doc"
- secure: encryptedOAuthToken
- GH_OWNER: yeoman
- GH_PROJECT_NAME: generator
- PACKAGE_NAME: yeoman-generator
- secure: Hv7gACQoYGtesz1NTJYRHjGCimEJEjj4bQP2iTpDUUbfAiYe/4QPemoyDEFjRxbu5m2uoYwMk0AQrW7DnQhNAhl7u24jYnRgQyd/2GOx3xZgjwnao27gsrTHss4IyXEaS2h3kRuIVSD+xibz/lwZm+erHOQ9VOwvCQkOKnILXW8=
20 changes: 15 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ echo "Changed directory to: "
pwd
echo -e ""

# Clean out existing contents
rm -rf **
echo -e "Cleaned out existing contents of $DOCS_DIR\n"

# Clone the existing gh-pages into $DOCS_DIR
git clone $REPO .
echo -e "Cloned $REPO\n"
git checkout $TARGET_BRANCH

# Clean out existing contents
rm -rf **
echo -e "Cleaned out existing contents of $DOCS_DIR\n"

# Generate docs in $TRAVIS_BUILD_DIR
cd $TRAVIS_BUILD_DIR
npm run doc
Expand All @@ -40,12 +40,22 @@ echo -e "Generated docs\n"
# Change directory to $DOCS_DIR
cd $DOCS_DIR

# Flatten content of $DOCS_DIR
mv $PACKAGE_NAME/**/** ./
rm -rf $PACKAGE_NAME

# Git setup
git config user.name $COMMIT_AUTHOR_NAME
git config user.email $COMMIT_AUTHOR_EMAIL

# Exit if there are no changes to the generated content
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to the output on this run; exiting."
exit 0
fi

# Commit the new of the new version
git add .
git add --all .
git commit -m "Deploy docs to GitHub Pages ($TRAVIS_TAG)"
echo -e "Comitted docs to $TARGET_BRANCH\n"

Expand Down
8 changes: 7 additions & 1 deletion jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
},
"opts": {
"recurse": true,
"destination": "../yeoman-generator-doc/"
"destination": "../yeoman-generator-doc/",
"package": "package.json"
},
"templates": {
"default": {
"includeDate": false
}
},
"plugins": [
"plugins/markdown"
Expand Down

0 comments on commit 87b210b

Please sign in to comment.