forked from DIAGNijmegen/website-content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
47 lines (36 loc) · 1.16 KB
/
deploy.sh
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
# #!/usr/bin/env bash
# Break build on error, prevents websites going offline in case of pelican errors
set -e
echo "Starting Pelican build of $WEBSITE"
cd $WEBSITE
# Development deploys (e.g. to develop.diagnijmegen.nl)
if [ "$DEVELOPMENT" = "1" ]; then
pelican content
# Copy images locally (dev deploy does not use CDN)
cp -r --no-clobber ../assets/images/. output/images
cp -r --no-clobber ../content/images/. output/images
# Custom robots file for dev sites
cp robots_dev.txt output/robots.txt
else
# Build pelican website for deployment
pelican content -s publishconf.py
fi
# Copy files for github
cp README.md output/README.md
if [[ -e .nojekyll ]]; then
cp .nojekyll output/.nojekyll
fi
if [[ -e netlify.toml ]]; then
cp netlify.toml output/netlify.toml
fi
if [[ -e robots.txt ]]; then
cp robots.txt output/robots.txt
fi
# Remove individual calendar events
# These pages are generated by Pelican but we don't want them displayed on the website
# as individual files. Only the calendar overview has to be shown.
if [[ -d output/calendar ]]; then
(cd output/calendar && ls | grep -v index.html | xargs rm -rf)
fi
# Go back to root directory
cd ..