diff --git a/deploy.sh b/deploy.sh index c5beb08..92a4d65 100755 --- a/deploy.sh +++ b/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