2024-08-14 12:16:13 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
2024-08-14 12:37:47 -04:00
|
|
|
check_command() {
|
|
|
|
command -v "$1" >/dev/null 2>&1
|
|
|
|
}
|
2024-08-14 12:16:13 -04:00
|
|
|
|
2024-08-14 12:37:47 -04:00
|
|
|
if ! check_command git; then
|
|
|
|
echo "git not found, please install it!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-08-14 12:16:13 -04:00
|
|
|
|
2024-08-14 12:37:47 -04:00
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "Usage: $(basename "$0") <path>"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-08-14 12:16:13 -04:00
|
|
|
|
2024-08-14 12:37:47 -04:00
|
|
|
git config --global user.email "support@ttnrtsite.me"
|
|
|
|
git config --global user.name "TTGit Automation Bot"
|
|
|
|
git config --global --add --bool push.autoSetupRemote true
|
|
|
|
|
2024-08-14 13:23:02 -04:00
|
|
|
git fetch
|
|
|
|
|
2024-08-14 12:37:47 -04:00
|
|
|
if ! git ls-remote --exit-code --heads origin pages; then
|
2024-10-02 22:18:03 -04:00
|
|
|
git checkout --orphan pages
|
2024-08-14 12:37:47 -04:00
|
|
|
git rm -rf .
|
|
|
|
else
|
2024-10-02 21:54:33 -04:00
|
|
|
git checkout -f pages
|
2024-08-14 12:37:47 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -d "$1" ]; then
|
|
|
|
echo "$1 does not exist! Try setting inputs.path"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp -r "$1"/* . && rm -rf "$1"
|
|
|
|
git add -A
|
2024-10-02 22:18:03 -04:00
|
|
|
git commit -am "TTPages: Automated Update"
|
2024-08-14 12:37:47 -04:00
|
|
|
git push -u
|