Improve the init tool & fix the deploy tool.

This commit is contained in:
Cotes Chung 2020-09-04 19:49:18 +08:00
parent 9dcab7ac1f
commit 13abcd5958
2 changed files with 12 additions and 7 deletions

View file

@ -24,7 +24,7 @@ init() {
}
backup() {
mv _site "$_backup_dir"
mv _site/* "$_backup_dir"
mv .git "$_backup_dir"
# When adding custom domain from Github website,

View file

@ -24,13 +24,18 @@ help() {
check_init() {
local _has_inited=false
if [[ -d .github ]]; then
if [[ -f .github/workflows/$ACTIONS_WORKFLOW && \
$(find .github/workflows/ -type f -name "*.yml" | wc -l) == 1 ]]; then
_has_inited=true
if [[ ! -d docs ]]; then
if [[ ! -d .github ]]; then
_has_inited=true # --no-gh
else
if [[ -f .github/workflows/$ACTIONS_WORKFLOW ]]; then
# on BSD, the `wc` could contains blank
local _count="$(find .github/workflows/ -type f -name "*.yml" | wc -l)"
if [[ ${_count//[[:blank:]]/} == 1 ]]; then
_has_inited=true
fi
fi
fi
else
_has_inited=true
fi
if $_has_inited; then