-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·50 lines (37 loc) · 1.36 KB
/
build.sh
File metadata and controls
executable file
·50 lines (37 loc) · 1.36 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
#!/usr/bin/env bash
set -eu
original_dir="$(pwd)"
cd "$(dirname "$0")"
function echo_step () {
echo ''
echo -e "\033[32m\033[1m$1...\033[0m"
}
rm -rfd hurl.dev/_site/*
export CI_COMMIT_SHORT_SHA
CI_COMMIT_SHORT_SHA=$(git rev-parse --short HEAD)
echo_step 'First pass static build'
# First pass, build static site with git commit.
jekyll build --source hurl.dev --destination hurl.dev/_site --future
echo_step 'Search index build'
# Then build search index from the first pass.
mkdir -p hurl.dev/assets/data/
python3 build_index.py > hurl.dev/assets/data/index.json
echo_step 'Second pass static build'
# Second pass to take the rebuilt search index into account.
jekyll build --source hurl.dev --destination hurl.dev/_site --future
echo_step 'Replace home samples'
python3 build_home_samples.py
echo_step 'Highlight code snippets'
python3 highlight.py
echo_step 'Add title anchors'
python3 build_anchors.py
echo_step 'Generating sitemap'
python3 build_sitemap.py > hurl.dev/_site/sitemap.txt
echo_step 'Generating feed.xml'
cp hurl.dev/_posts/feed.xml hurl.dev/_site/blog/
sites_dir=$(realpath --relative-to="$original_dir" "$(pwd)")
echo ''
echo 'Run local site'
echo '-------------------'
echo " Build & watch: jekyll serve --source $sites_dir/hurl.dev --destination $sites_dir/hurl.dev/_site"
echo " Static: python3 -m http.server --dir $sites_dir/hurl.dev/_site 4000"