update deploy.sh
This commit is contained in:
parent
1e6a1f2139
commit
7a0f43e965
27
deploy.sh
27
deploy.sh
@ -16,22 +16,26 @@ init() {
|
|||||||
build() {
|
build() {
|
||||||
# Run the Ruby script to generate the output
|
# Run the Ruby script to generate the output
|
||||||
bundle exec ruby "./scaffold.rb"
|
bundle exec ruby "./scaffold.rb"
|
||||||
|
|
||||||
# Move all generated files to the root directory
|
|
||||||
mv ./_output/* ./
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_gh() {
|
setup_gh() {
|
||||||
# Delete the branch if it exists, and create a new one
|
|
||||||
if git show-ref --verify --quiet "refs/heads/$PAGES_BRANCH"; then
|
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"
|
git checkout -b "$PAGES_BRANCH"
|
||||||
|
else
|
||||||
|
git checkout "$PAGES_BRANCH"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
flush() {
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
rm -rf !(CNAME|_output)
|
||||||
|
rm -rf .[^.] .??* !(CNAME|_output)
|
||||||
|
|
||||||
|
shopt -u extglob
|
||||||
|
|
||||||
|
# Move all generated files to the root directory
|
||||||
|
mv ./_output/* ./
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy() {
|
deploy() {
|
||||||
@ -52,6 +56,7 @@ main() {
|
|||||||
init # Initialize and validate environment
|
init # Initialize and validate environment
|
||||||
build # Build the site
|
build # Build the site
|
||||||
setup_gh # Set up the gh-pages branch
|
setup_gh # Set up the gh-pages branch
|
||||||
|
flush
|
||||||
deploy # Deploy the site
|
deploy # Deploy the site
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user