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)"
|
_backup_dir="$(mktemp -d)"
|
||||||
|
|
||||||
|
DATE_STAMP=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
# Check if the script is running in a GitHub Actions environment
|
echo "Initializing..."
|
||||||
if [[ -z ${GITHUB_ACTION+x} ]]; then
|
|
||||||
echo "ERROR: Not allowed to deploy outside of the GitHub Action environment."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
@ -62,12 +59,16 @@ deploy() {
|
|||||||
# Reset the current HEAD to prepare for new commits
|
# Reset the current HEAD to prepare for new commits
|
||||||
git update-ref -d HEAD
|
git update-ref -d HEAD
|
||||||
git add -A
|
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
|
# Push the new branch to the remote repository
|
||||||
git push -u origin "$PAGES_BRANCH" --force
|
git push -u origin "$PAGES_BRANCH" --force
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
git checkout main
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
init
|
init
|
||||||
build
|
build
|
||||||
@ -75,6 +76,7 @@ main() {
|
|||||||
backup
|
backup
|
||||||
flush
|
flush
|
||||||
deploy
|
deploy
|
||||||
|
reset
|
||||||
}
|
}
|
||||||
|
|
||||||
# Execute the main function
|
# Execute the main function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user