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

Auto update gh-pages branch when docs are updated. #44

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js
node_js:
- "8"

cache:
directories:
- "node_modules"

before_script:
- chmod +x deploy.sh

script:
- ./deploy.sh
43 changes: 21 additions & 22 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
#!/bin/bash

rm -rf dddocs
rm -rf docs-build
if [ -z "$TRAVIS_TAG" ]; then
echo "Not a TAG, skip the update."
exit 0
fi

git clone --quiet --branch=gh-pages https://cadasta:[email protected]/cadasta/api-docs /home/travis/build/cadasta/docs-branch

mkdir docs-build
npm install
npm run build

git clone -b gh-pages --single-branch [email protected]:Cadasta/api-docs.git dddocs
yes | cp -rf docs-build/index.html dddocs
yes | cp -rf docs-build/bundle.js dddocs
yes | cp -rf css dddocs/css
yes | cp -rf lib dddocs/lib
cp -rf docs-build/index.html /home/travis/build/cadasta/docs-branch
cp -rf docs-build/bundle.js /home/travis/build/cadasta/docs-branch
cp -rf css /home/travis/build/cadasta/docs-branch/css
cp -rf lib /home/travis/build/cadasta/docs-branch/lib

cd dddocs
if [[ $(git diff) || "$1" == "initial" ]]; then
echo "Deploying..."
git add .
git commit -m 'Deploy docs'
git push origin gh-pages
else
echo "Nothing to deploy."
fi
cd /home/travis/build/cadasta/docs-branch

git config --global user.name "m-murad"
git config --global user.email "[email protected]"

echo "Cleaning up..."
cd ..
rm -rf dddocs
rm -rf docs-build
echo "Done."
git add .
git commit -m "Docs updated for $TRAVIS_TAG"
# git push origin gh-pages --quiet
git checkout -b gh-pages-temp
git push origin gh-pages-temp --quiet
echo "Docs updated."