Skip to content

Commit

Permalink
update deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
app-harry committed Oct 27, 2024
1 parent 1e6a1f2 commit 7a0f43e
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,26 @@ init() {
build() {
# Run the Ruby script to generate the output
bundle exec ruby "./scaffold.rb"

# Move all generated files to the root directory
mv ./_output/* ./
}

setup_gh() {
# Delete the branch if it exists, and create a new one
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
git checkout -b "$PAGES_BRANCH"
else
echo "Branch '$PAGES_BRANCH' does not exist locally. Skipping deletion."
git checkout "$PAGES_BRANCH"
fi
}

flush() {
shopt -s extglob

# Create and switch to the new branch
git checkout -b "$PAGES_BRANCH"
rm -rf !(CNAME|_output)
rm -rf .[^.] .??* !(CNAME|_output)

shopt -u extglob

# Move all generated files to the root directory
mv ./_output/* ./
}

deploy() {
Expand All @@ -52,6 +56,7 @@ main() {
init # Initialize and validate environment
build # Build the site
setup_gh # Set up the gh-pages branch
flush
deploy # Deploy the site
}

Expand Down

0 comments on commit 7a0f43e

Please sign in to comment.