Skip to content

Commit

Permalink
update doc generation script so it doesn't drop branch docs
Browse files Browse the repository at this point in the history
  • Loading branch information
d-fischer committed Jan 14, 2020
1 parent 3ef2b01 commit 7900305
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ script:
jobs:
include:
- stage: Publish docs
if: type = push AND fork = false AND tag IS blank AND branch = master
if: type = push AND fork = false AND tag IS blank AND !(branch =~ /^dependabot\//)
script: lerna bootstrap && lerna run build && scripts/travis/publishDocs.sh
22 changes: 18 additions & 4 deletions scripts/travis/publishDocs.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
#!/bin/bash

set -e
shopt -s extglob

REPO_USER="${TRAVIS_REPO_SLUG%/*}"

npm run docs -- --base-url "/"
if [[ $TRAVIS_BRANCH = "master" ]]; then
BASE_URL="/"
else
BASE_URL="/branches/${TRAVIS_BRANCH}/"
fi

npm run docs -- --base-url "${BASE_URL}"

git clone "https://${GH_TOKEN}@github.com/${REPO_USER}/${REPO_USER}.github.io.git" docRepo
rm -rfv docRepo/*
mv -fv generatedDocs/* docRepo/

if [[ $TRAVIS_BRANCH = "master" ]]; then
GLOBIGNORE="branches" rm -rfv docRepo/*
mv -fv generatedDocs/* docRepo/
else
rm -rfv docRepo/branches/"${TRAVIS_BRANCH}"/*
mkdir -pv "docRepo/branches/${TRAVIS_BRANCH}"
mv -fv generatedDocs/* "docRepo/branches/${TRAVIS_BRANCH}"
fi

cd docRepo

Expand All @@ -17,6 +31,6 @@ git config user.name "Travis CI"

if [[ $(git status --porcelain) ]]; then
git add .
git commit -m "Travis build: ${TRAVIS_BUILD_NUMBER}"
git commit -m "Travis build ${TRAVIS_BUILD_NUMBER}, branch ${TRAVIS_BRANCH}"
git push --quiet --set-upstream origin master
fi

0 comments on commit 7900305

Please sign in to comment.