-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish the book to GitHub Pages via Travis CI
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
language: node_js | ||
dist: trusty | ||
sudo: required | ||
|
||
node_js: | ||
- 'stable' | ||
|
||
cache: | ||
directories: | ||
- ./src/node_modules/ | ||
|
||
before_install: | ||
- sudo apt-get -qq update | ||
|
||
install: | ||
- npm install -g gitbook-cli | ||
|
||
before_script: | ||
- chmod u+x ./tools/travis-ci/build-and-tag.bash | ||
|
||
script: | ||
- ./tools/travis-ci/build-and-tag.bash | ||
|
||
before_deploy: | ||
- cd ${TRAVIS_BUILD_DIR} | ||
|
||
deploy: | ||
- provider: pages | ||
skip_cleanup: true | ||
github_token: ${GITHUB_TOKEN} | ||
local_dir: ./src/_book/ | ||
target_branch: gh-pages | ||
on: | ||
branch: master | ||
|
||
branches: | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
# *must* be invoked from the root of the repository (with no args) | ||
|
||
# shell color constants | ||
RED='\033[1;31m' | ||
GREEN='\033[1;32m' | ||
YELLOW='\033[1;33m' | ||
BLUE='\033[1;34m' | ||
CLEAR='\033[0m' | ||
|
||
BUILD_NAME="openra-book-v${TRAVIS_BUILD_NUMBER}" | ||
|
||
# print all the travis env vars to the console for debugging | ||
echo -e "TRAVIS_BUILD_NUMBER: [${GREEN}${TRAVIS_BUILD_NUMBER}${CLEAR}]" | ||
echo -e "TRAVIS_COMMIT: [${GREEN}${TRAVIS_COMMIT}${CLEAR}]" | ||
echo -e "TRAVIS_BRANCH: [${GREEN}${TRAVIS_BRANCH}${CLEAR}]" | ||
echo -e "TRAVIS_TAG: [${GREEN}${TRAVIS_TAG}${CLEAR}]" | ||
echo -e "TRAVIS_PULL_REQUEST: [${GREEN}${TRAVIS_PULL_REQUEST}${CLEAR}]" | ||
echo -e "TRAVIS_EVENT_TYPE: [${GREEN}${TRAVIS_EVENT_TYPE}${CLEAR}]" | ||
echo -e "BUILD_NAME: [${GREEN}${BUILD_NAME}${CLEAR}]" | ||
|
||
# build the book | ||
echo -e "${GREEN}building the book${CLEAR}" | ||
cd ./src/ | ||
gitbook install | ||
gitbook build | ||
|
||
# remove unwanted files from the book | ||
echo -e "${GREEN}removing unwanted files{$CLEAR}" | ||
rm -v _book/.travis.yml | ||
rm -v _book/*.yml | ||
rm -v _book/*.bash | ||
|
||
# if this is a build of 'master' then create & push a new git tag | ||
if [[ "${TRAVIS_BRANCH}" == "master" ]]; then | ||
git config --global user.email 'orabot@openra.net' | ||
git config --global user.name 'orabot' | ||
|
||
echo -e "${RED}todo: implement this${CLEAR}" | ||
else | ||
echo -e "${GREEN}branch is not 'master' so skipping git tag creation" | ||
fi |