Skip to content

Commit c393e59

Browse files
committed
Reconfigures travis CI to push new book to docs directory
1 parent 00a5871 commit c393e59

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

.travis.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
language: r
2-
32
sudo: false
3+
cache: packages
44

5-
cache:
6-
packages: true
5+
before_script:
6+
- chmod +x ./_build.sh
7+
- chmod +x ./_deploy.sh
78

89
script:
9-
- Rscript -e 'bookdown::render_book("index.rmd")'
10+
- ./_build.sh
11+
- ./_deploy.sh

_build.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
set -ev
4+
5+
Rscript -e 'bookdown::render_book("index.rmd")'

_deploy.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
[ -z "${GITHUB_PAT}" ] && exit 0
6+
[ "${TRAVIS_BRANCH}" != "master" ] && exit 0
7+
8+
git config --global user.email "[email protected]"
9+
git config --global user.name "Garrett Grolemund"
10+
11+
git clone https://${GITHUB_PAT}@github.com/${TRAVIS_REPO_SLUG}.git book-output
12+
cd book-output/docs/
13+
git rm -rf *
14+
cp -r ../../docs/* ./
15+
git add --all *
16+
git commit -m"Update the book" || true
17+
git push -q origin gh-pages

0 commit comments

Comments
 (0)