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() { backup() {
mv _site "$_backup_dir" mv _site/* "$_backup_dir"
mv .git "$_backup_dir" mv .git "$_backup_dir"
# When adding custom domain from Github website, # When adding custom domain from Github website,

View file

@ -24,13 +24,18 @@ help() {
check_init() { check_init() {
local _has_inited=false local _has_inited=false
if [[ -d .github ]]; then if [[ ! -d docs ]]; then
if [[ -f .github/workflows/$ACTIONS_WORKFLOW && \ if [[ ! -d .github ]]; then
$(find .github/workflows/ -type f -name "*.yml" | wc -l) == 1 ]]; 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 _has_inited=true
fi fi
else fi
_has_inited=true fi
fi fi
if $_has_inited; then if $_has_inited; then