From 0f8ad2ba20b2de7e4bde50937555f61127c47e2d Mon Sep 17 00:00:00 2001 From: app-harry Date: Sun, 27 Oct 2024 00:08:48 +0800 Subject: [PATCH] update deploy.sh --- deploy.sh | 7 ++++++- scaffold.rb | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index c57d745..5e692be 100755 --- a/deploy.sh +++ b/deploy.sh @@ -23,7 +23,12 @@ build() { setup_gh() { # Delete the branch if it exists, and create a new one - git branch -D "$PAGES_BRANCH" + if git show-ref --verify --quiet "refs/heads/$PAGES_BRANCH"; then + echo "Branch '$PAGES_BRANCH' exists. Deleting it..." + git branch -D "$PAGES_BRANCH" # Delete the local branch + else + echo "Branch '$PAGES_BRANCH' does not exist locally. Skipping deletion." + fi # Create and switch to the new branch git checkout -b "$PAGES_BRANCH" diff --git a/scaffold.rb b/scaffold.rb index 37a4124..7a5e7ae 100644 --- a/scaffold.rb +++ b/scaffold.rb @@ -25,10 +25,8 @@ if Dir.exist?(destination_dir) puts "Deleted: #{file_path}" end end - puts "All files have been removed from #{destination_dir}." else FileUtils.mkdir_p(destination_dir) - puts "Directory #{destination_dir} does not exist." end # Copy all files and directories while preserving the structure