-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.sh
executable file
·49 lines (36 loc) · 1.09 KB
/
build.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
48
49
#!/bin/bash
set -e
git config core.quotePath false
version_branches="$(git for-each-ref --format='%(refname:lstrip=3)' refs/remotes/*/v*.* | sort -Vur)"
function build() {
sed -i 's/^id = "UA-/# id = "UA-/' config.toml # disable GA
if [[ "$1" != "" ]]; then
sed -i "s/^version = \".*\"/version = \"$1\"/" config.toml
sed -i "s/^github_branch = \".*\"/github_branch = \"$1\"/" config.toml
fi
echo "[[params.versions]]
version = \"alpha\"
url = \"https://cpeditor.org/\"" >>config.toml
for version in $version_branches; do
echo "[[params.versions]]
version = \"$version\"
url = \"https://cpeditor.org/$version\"" >>config.toml
done
hugo --minify
if [[ "$1" != "" ]]; then
rm public/CNAME public/robots.txt
fi
git reset --hard
}
git checkout hugo
build
rm -rf dist || true
mv public dist
for branch in $version_branches; do
git checkout "$branch"
git submodule update --init --recursive
build "$branch"
mv public "dist/$branch"
done
git checkout hugo
git submodule update --init --recursive