-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish-site.sh
executable file
·39 lines (28 loc) · 952 Bytes
/
publish-site.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
#!/usr/bin/env bash
rm rsync-log
docker compose build && docker compose run --rm \
-v "$(pwd)":/src \
-v "$(realpath "${PROJECTS_LOCATION}")":/projects -e PROJECTS_LOCATION=/projects \
-v "$(realpath "${BIO_LOCATION}")":/bio \
-e BIO_PATH=/bio/bio.md \
-e BIO_AUTHOR_PICTURE="/bio/profile-pic.jpg" \
-e RESUME_LOCATION="/bio/resume.md" \
-w /src -u "$(id -u)":"$(id -g)" \
npm run build-release
EXIT_CODE=${PIPESTATUS[0]}
if [ "$EXIT_CODE" -ne 0 ]; then
exit "${EXIT_CODE}"
fi
rsync -avzh --delete --log-file=rsync-log --exclude app-config.json \
./build/ "$SSH_USERNAME"@"$SSH_HOST":/home/protected/app
EXIT_CODE=$?
if [ "$EXIT_CODE" -ne 0 ]; then
exit "${EXIT_CODE}"
fi
cat rsync-log
if grep -q -E '<f[\.\+stp]+[[:blank:]]app-release.[cm]?js' rsync-log; then
ssh "$SSH_USERNAME"@"$SSH_HOST" \
-t "chmod +x /home/protected/app/start-server.sh && nfsn signal-daemon 'Node' term"
fi
EXIT_CODE=$?
exit "${EXIT_CODE}"