-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfig.yml
More file actions
125 lines (115 loc) · 3.5 KB
/
config.yml
File metadata and controls
125 lines (115 loc) · 3.5 KB
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
version: 2.1
workflows:
version: 2
# The build workflow will build a preview for the site, intended for PRs
## build:
## jobs:
## - build-site:
## filters:
## branches:
## ignore: master
# The build nightly has a content (below) that indicates deployment
build-nightly:
triggers:
- schedule:
cron: "0 0 27 11 *"
filters:
branches:
only:
- master
jobs:
- build-site:
context: trigger-context
filters:
branches:
only:
- master
install: &install
name: install dependencies for build
command: |
$HOME/conda/bin/pip install -r ~/repo/.circleci/requirements.txt
deploy: &deploy
name: Deploy back to GitHub master, only in the case that CIRCLECI_TRIGGER is found
command: |
# Only deploy if the CIRCLECI_TRIGGER is found in the environment
if [ -z "$CIRCLECI_TRIGGER" ]; then
echo "CIRCLECI_TRIGGER not found, not nightly build, will not deploy."
exit 0
else
echo "Detected trigger, updating GitHub pages!"
git branch
git config user.name "${CIRCLECI_USERNAME}"
git config user.email "${CIRCLECI_USERNAME}@users.noreply.github.com"
git checkout master
git pull origin master
git add ~/repo/_posts/*
git commit -m 'Automated deployment to Github Pages' --allow-empty
git push origin master
echo $?
fi
install_python_3: &install_python_3
name: install Python 3.5 dependencies
command: |
ls $HOME
if [ ! -d "/home/circleci/conda" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
/bin/bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/conda
export PATH=$HOME/conda/bin:$PATH
else
echo "Miniconda 3 is already installed, continuing to build."
fi
generate_posts: &generate_posts
name: Generate markdown posts from the feed
command: |
cd ~/repo/script
echo "Looking for new posts..."
$HOME/conda/bin/python generate_posts.py ../_data/authors.yml --output ../_posts/
build_jekyll: &build_jekyll
name: Jekyll Build
command: |
if [ -z "$CIRCLECI_TRIGGER" ]; then
echo "Building RSE Blog for Preview"
cp ~/repo/.circleci/circle_urls.sh ~/repo/circle_urls.sh
cd ~/repo
chmod u+x circle_urls.sh
bash circle_urls.sh
bundle exec jekyll build
else
echo "Nightly build detected, preview not needed."
fi
jobs:
build-site:
docker:
- image: circleci/ruby:2.4.1
working_directory: ~/repo
environment:
- JEKYLL_ENV: production
- NOKOGIRI_USE_SYSTEM_LIBRARIES: true
- BUNDLE_PATH: ~/repo/vendor/bundle
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies
- rubygems-v1
- run: *install_python_3
- run: *install
- save_cache:
paths:
- /home/circleci/conda
key: v1-dependencies
- run:
name: Bundle Install
command: |
cd ~/repo
bundle check || bundle install
- save_cache:
key: rubygems-v1
paths:
- vendor/bundle
- run: *generate_posts
- run: *build_jekyll
- store_artifacts:
path: ~/repo/_site
destination: blog
- run: *deploy