Update to run outside of gh-actions
This commit is contained in:
parent
370e8d6e54
commit
a53f154c04
14
deploy.sh
14
deploy.sh
@ -9,13 +9,10 @@ SITE_DIR="_output"
|
||||
|
||||
_backup_dir="$(mktemp -d)"
|
||||
|
||||
DATE_STAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
init() {
|
||||
# Check if the script is running in a GitHub Actions environment
|
||||
if [[ -z ${GITHUB_ACTION+x} ]]; then
|
||||
echo "ERROR: Not allowed to deploy outside of the GitHub Action environment."
|
||||
exit 1
|
||||
fi
|
||||
echo "Initializing..."
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -62,12 +59,16 @@ deploy() {
|
||||
# Reset the current HEAD to prepare for new commits
|
||||
git update-ref -d HEAD
|
||||
git add -A
|
||||
git commit -m "[Automation] Site update No.${GITHUB_RUN_NUMBER}"
|
||||
git commit -m "[Automation] Site update: ${DATE_STAMP}"
|
||||
|
||||
# Push the new branch to the remote repository
|
||||
git push -u origin "$PAGES_BRANCH" --force
|
||||
}
|
||||
|
||||
reset() {
|
||||
git checkout main
|
||||
}
|
||||
|
||||
main() {
|
||||
init
|
||||
build
|
||||
@ -75,6 +76,7 @@ main() {
|
||||
backup
|
||||
flush
|
||||
deploy
|
||||
reset
|
||||
}
|
||||
|
||||
# Execute the main function
|
||||
|
Loading…
x
Reference in New Issue
Block a user