amis/deploy-gh-pages.sh

39 lines
759 B
Bash
Raw Normal View History

2019-06-05 10:45:36 +08:00
#!/bin/bash
set -e
2020-08-21 11:51:35 +08:00
if [ -z "$(git status --porcelain)" ]; then
2019-06-05 10:45:36 +08:00
# Working directory clean
echo "Working directory clean"
2020-08-21 11:51:35 +08:00
else
2019-06-05 10:45:36 +08:00
# Uncommitted changes
read -p "You got uncommitted changes, press y to continue? " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Skiped!"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
2019-06-05 10:45:36 +08:00
fi
rm -rf gh-pages
fis3 release gh-pages -c
2019-06-05 10:51:40 +08:00
node ./build/upload2cdn.js $1
2019-06-05 10:45:36 +08:00
2020-08-21 11:51:35 +08:00
node ./build/generate-search-data.js
2019-06-05 10:45:36 +08:00
git add gh-pages -f
git commit -m "更新 gh-pages"
git push
git subtree push --prefix gh-pages origin gh-pages
git commit -m 'rebuild pages' --allow-empty
git push origin
2020-08-21 11:51:35 +08:00
echo "done"