forked from sculpin/sculpin-blog-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpublish.sh
executable file
·29 lines (24 loc) · 926 Bytes
/
publish.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
#!/bin/bash
SCULPIN_REPO_PATH=.
GITHUB_PAGE_REPO_PATH=../benit.github.io
#check commit message
if [ $# -ne 1 ]; then
echo "commit message required"
exit 1;
fi
#generate html for github pages
cd $SCULPIN_REPO_PATH
#vendor/bin/sculpin generate --env=prod
docker container exec github-blog sh -c "cd /github-blog/ && composer install && php vendor/bin/sculpin generate --env=prod"
#synchronize with repo that host github pages on master branch
rsync -a --exclude .git $SCULPIN_REPO_PATH/output_prod/ $GITHUB_PAGE_REPO_PATH --delete
read -p "Content generated and sync. Do you want to both commit and push to blog repo and github pages repo with commit message : $1" -n 1 -r
#commit to the repo that version our blog source code
git add -A
git commit -m "$1"
git push origin master
#commit to repo that host github pages on master branch
cd $GITHUB_PAGE_REPO_PATH
git add -A
git commit -m "$1"
git push origin master