ssp6904.ttnrtsite.io/run.sh

39 lines
734 B
Bash
Raw Normal View History

2024-07-25 16:12:55 -04:00
#!/usr/bin/env bash
set -eo pipefail
check_command() {
command -v "$1" >/dev/null 2>&1
}
if ! check_command git; then
echo "git not found, please install it!"
exit 1
fi
if [ $# -ne 1 ]; then
echo "Usage: $(basename "$0") <path>"
exit 1
fi
git config --global user.email "hoffershaun842@gmail.com"
git config --global user.name "TTGit Automation Bot"
git config --global --add --bool push.autoSetupRemote true
if ! git ls-remote --exit-code --heads origin pages; then
git checkout --orphan pages
git rm -rf .
else
git checkout pages
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
git commit -a -m "TTPages: Automated Update"
git push -u