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 26, 2024
1 parent be2a1b0 commit 129c395
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 62 deletions.
Binary file modified .DS_Store
Binary file not shown.
49 changes: 49 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# ref: https://github.com/jekyll/jekyll

set -eu

PAGES_BRANCH="gh-pages"

init() {
if [[ -z ${GITHUB_ACTION+x}]]; then
echo "ERROR: Not allowed to deploy outside of the GitHub Action envrionment."
exit -1
fi
}

build() {
bundle exec ruby "./scaffold.rb"

mv ./_output/* ./
}

setup_gh() {
if git branch --list "$PAGES_BRANCH" > /dev/null; then
echo "Branch '$PAGES_BRANCH' exists. Deleting and recreating it..."
git branch -D "$PAGES_BRANCH" # Delete the branch
fi

# Create and switch to the branch
git checkout -b "$PAGES_BRANCH"
}

deploy() {
git config --global user.name "ZhgChgLiBot"
git config --global user.email "[email protected]"

git update-ref -d HEAD
git add -A
git commit -m "[Automation] Site update No.${GITHUB_RUN_NUMBER}"

git push -u origin "$PAGES_BRANCH"
}

main() {
init
build
setup_gh
deploy
}

main
62 changes: 0 additions & 62 deletions scaffold/config.rb

This file was deleted.

0 comments on commit 129c395

Please sign in to comment.