Docs auto-push to gh-pages branch
This commit is contained in:
parent
1ffa4cf183
commit
43f050ae44
3 changed files with 40 additions and 33 deletions
50
.travis.yml
50
.travis.yml
|
|
@ -10,10 +10,10 @@ cache:
|
|||
directories:
|
||||
- node_modules
|
||||
|
||||
# Custom install step so the travis scripts don't need to be in package.json
|
||||
# Custom install step so the travis-only stuff doesn't need to be in package.json
|
||||
install:
|
||||
- npm install
|
||||
- npm install @alrra/travis-scripts@^3.0.1
|
||||
- npm install @alrra/travis-scripts@^3.0.1 gh-pages@^0.12.0
|
||||
|
||||
# Bundle before running tests so the bundle is always up-to-date
|
||||
before_script: npm run build
|
||||
|
|
@ -21,37 +21,43 @@ before_script: npm run build
|
|||
# This is the default, but leaving so it is obvious
|
||||
# script: npm test
|
||||
|
||||
# After a successful build create bundles & commit back to the repo
|
||||
# After a successful build commit changes back to repo
|
||||
after_success:
|
||||
- |
|
||||
# Set up SSH environment
|
||||
$(npm bin)/set-up-ssh \
|
||||
--key "$encrypted_8b86e0359d64_key" \
|
||||
--iv "$encrypted_8b86e0359d64_iv" \
|
||||
--path-encrypted-key "./.deploy.enc"
|
||||
|
||||
# Commit bundle changes generated in before_script step
|
||||
# --commands is a weird no-op but required for commit-changes to run
|
||||
# --branch arg is to ensure this only runs against the `next` branch
|
||||
$(npm bin)/commit-changes \
|
||||
--commands "echo committing" \
|
||||
--commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
|
||||
--branch "next"
|
||||
|
||||
# Only want to commit when building a push on whatever $BRANCH is
|
||||
# Only want to commit docs when building pushes on master &
|
||||
# this doesn't have the built-in branch protection likt commit-changes
|
||||
if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
|
||||
[ "$TRAVIS_BRANCH" == "$BRANCH" ] && \
|
||||
[ "$TRAVIS_REPO_SLUG" == "$REPO" ]
|
||||
[ "$TRAVIS_BRANCH" == "master" ] && \
|
||||
[ "$TRAVIS_REPO_SLUG" == "lhorie/mithril.js" ]
|
||||
then
|
||||
# Set up SSH environment
|
||||
$(npm bin)/set-up-ssh \
|
||||
--key "$encrypted_8b86e0359d64_key" \
|
||||
--iv "$encrypted_8b86e0359d64_iv" \
|
||||
--path-encrypted-key "./.deploy.enc"
|
||||
# Generate docs
|
||||
$(npm-bin) run gendocs
|
||||
|
||||
# Commit changes (if there were any) from running build earlier
|
||||
$(npm bin)/commit-changes \
|
||||
--commands "echo committing" \
|
||||
--commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
|
||||
--branch "$BRANCH"
|
||||
# Commit docs to gh-pages branch
|
||||
# Using --add to ensure that archived versions aren't lost
|
||||
# Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
|
||||
$(npm bin)/gh-pages --dist ./dist --add --repo "git@github.com:lhorie/mithril.js.git"
|
||||
else
|
||||
echo "Not submitting build artifacts"
|
||||
echo "Not submitting documentation updates"
|
||||
fi
|
||||
|
||||
|
||||
# Environment configuration
|
||||
env:
|
||||
global:
|
||||
# Restrict the branch this will activate on
|
||||
- BRANCH=next
|
||||
- REPO=lhorie/mithril.js
|
||||
|
||||
# Set up GH_USER_EMAIL & GH_USER_NAME env variables used by travis-scripts package
|
||||
- secure: Xvqvm3+PvJu/rs3jl/NNn0RWLkkLkIoPHiL0GCfVRaywgjCYVN02g54NVvIDaOfybqPmu9E6PJFVs92vhF34NMFQHf4EWskynusIGV271R2BV0i+OJBfLMuLgiwm6zRn7/Zw4JvWIUGEwcnlz0qxbqdHsS0SOR3fIkFzePickW0=
|
||||
- secure: Rf/ldEO9d4vItJhe6EmqWpFAyCARzoCb422nHnjr1hYJknnwIXpgyZ1C/7On/9o7rWPPf+8WcHC/rgjK2rthKCldzdG5I60LfWSNzap9lk3Aa4TpSCoDBuEp7JVvDr5tc3rKnBXVT71hOay7RSx1StWzXiJs9mjaeVMJzYzRT78=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue