post: Atlassian and Jira portal-only SSO
[curben-blog.git] / build.sh
blobc70e0cfea9e6a8e59799419020c5da9aa6542a2d
1 #!/bin/sh
3 if ! (set -o pipefail 2>/dev/null); then
4 # dash does not support pipefail
5 set -ex
6 else
7 set -ex -o pipefail
8 fi
10 export PATH="$PATH:./node_modules/.bin"
12 hexo generate
14 if [ "$NODE_ENV" = "production" ] && [ -d "public/" ]; then
15 # deploy site assets
16 git clone --depth 1 --branch site https://gitlab.com/curben/blog.git site
17 cp -r site/* "public/"
18 rm -f "public/README.md"
20 # deploy microblog
21 git clone --depth 1 --branch microblog https://gitlab.com/curben/blog.git microblog
22 cd "microblog/"
23 export PATH="$PATH:../node_modules/.bin"
24 hexo generate
26 cat "rsync-include.txt" | while read include; do
27 find "public/" -path "public/$include" -type f | while read file; do
28 destdir="../public/$(dirname $file | sed -r 's|^public/?||')"
29 mkdir -p "$destdir"
30 cp "$file" "$destdir"
31 done
32 done