forked from data-8/textbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.yml
147 lines (129 loc) · 4.29 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
version: 2.1
jobs:
deploy:
docker:
- image: circleci/python:3.6-stretch
steps:
- checkout
# Add deployment key fingerprint for CircleCI to use for a push
- add_ssh_keys:
fingerprints:
- "25:11:c6:86:6a:aa:66:ed:d9:56:b0:df:51:ca:f4:18"
- prepare_jekyll_installation
- run:
name: Build the website
command: bundle exec jekyll build
# Push to the inferentialthinking.github.io repository so it goes live
- run:
name: Deploying site using ghp-import
command: |
git remote add live_textbook [email protected]:inferentialthinking/inferentialthinking.github.io.git
pip install ghp-import
ghp-import -p -f -n -b master -r live_textbook -c www.inferentialthinking.com _site/
demo_site:
docker:
- image: circleci/python:3.6-stretch
steps:
# Attach the built html files
- checkout
- prepare_jekyll_installation
- run:
name: Build the website
command: bundle exec jekyll build --baseurl /0/html/
# Tell Circle to store the documentation output in a folder that we can access later
- store_artifacts:
path: ./_site/
destination: html
page_html:
docker:
- image: circleci/python:3.6-stretch
steps:
# Get our data and merge with upstream
- run: sudo apt-get update
- checkout
# Update our path
- run: echo "export PATH=~/.local/bin:$PATH" >> $BASH_ENV
# Restore cached files to speed things up
- restore_cache:
keys:
- cache-pip
# Install the packages needed to build our documentation
# This will depend on your particular package!
- run: pip install --user -r requirements.txt
- run: pip install --user -U git+https://github.com/jupyter/jupyter-book.git
# Cache some files for a speedup in subsequent builds
- save_cache:
key: cache-pip
paths:
- ~/.cache/pip
- run:
name: Build site html
command: jupyter-book build .
# Persist the specified paths (see https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs)
- persist_to_workspace:
root: .
paths:
- ./_build/
# Tell CircleCI to use this workflow when it builds the site
workflows:
version: 2
default:
jobs:
- page_html
- demo_site:
requires:
- page_html
filters:
branches:
ignore:
- gh-pages
- deploy:
requires:
- page_html
filters:
branches:
only:
- gh-pages
commands:
prepare_jekyll_installation:
steps:
# Attach the built html files
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: /tmp/workspace
# Grab the the built html from the last step
- run:
name: Copy over built site files
command: |
rm -rf ./_build
cp -r /tmp/workspace/_build ./
# Grab the the built intermediate files from the last step
- run:
name: Copy over built site files
command: |
rm -rf _build
cp -r /tmp/workspace/_build ./ # Install miniconda to test install
- run:
name: install miniconda
command: |
export MINICONDA=$HOME/miniconda
echo "export PATH=$MINICONDA/bin:$PATH" >> $BASH_ENV
source $BASH_ENV
hash -r
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -f -p $MINICONDA
conda config --set always_yes yes
conda update conda
conda info -a
conda create -n testenv python=3.7.0
source activate testenv
rm miniconda.sh
# Install Ruby/Jekyll dependencies
- run:
name: Installing Ruby/Jekyll from conda-forge
command: conda install -c conda-forge rb-github-pages
# Build the book's HTML w/ the base_url for CircleCI artifacts
- run:
name: Install book Ruby dependencies
command: |
bundle install