Skip to content

Commit 7b9791f

Browse files
committed
Improve the init tool & fix the deploy tool.
1 parent d473c71 commit 7b9791f

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

tools/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ init() {
2424
}
2525

2626
backup() {
27-
mv _site "$_backup_dir"
27+
mv _site/* "$_backup_dir"
2828
mv .git "$_backup_dir"
2929

3030
# When adding custom domain from Github website,

tools/init.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ help() {
2424
check_init() {
2525
local _has_inited=false
2626

27-
if [[ -d .github ]]; then
28-
if [[ -f .github/workflows/$ACTIONS_WORKFLOW && \
29-
$(find .github/workflows/ -type f -name "*.yml" | wc -l) == 1 ]]; then
30-
_has_inited=true
27+
if [[ ! -d docs ]]; then
28+
if [[ ! -d .github ]]; then
29+
_has_inited=true # --no-gh
30+
else
31+
if [[ -f .github/workflows/$ACTIONS_WORKFLOW ]]; then
32+
# on BSD, the `wc` could contains blank
33+
local _count="$(find .github/workflows/ -type f -name "*.yml" | wc -l)"
34+
if [[ ${_count//[[:blank:]]/} == 1 ]]; then
35+
_has_inited=true
36+
fi
37+
fi
3138
fi
32-
else
33-
_has_inited=true
3439
fi
3540

3641
if $_has_inited; then

0 commit comments

Comments
 (0)