2020-03-29 08:44:47 -06:00
|
|
|
#!/bin/sh -l
|
|
|
|
|
|
|
|
echo "Starts"
|
2020-03-29 09:07:19 -06:00
|
|
|
FOLDER="$1"
|
|
|
|
GITHUB_USERNAME="$2"
|
|
|
|
GITHUB_REPO="$3"
|
2020-03-29 09:20:35 -06:00
|
|
|
GIT_USER_EMAIL="$4"
|
2020-03-29 09:07:19 -06:00
|
|
|
|
2020-03-29 09:13:00 -06:00
|
|
|
CLONE_DIR="clone_repo"
|
|
|
|
|
2020-03-29 09:20:35 -06:00
|
|
|
# Setup git
|
|
|
|
git config --global user.email "$GIT_USER_EMAIL"
|
2020-03-29 09:07:19 -06:00
|
|
|
git config --global user.name "$GITHUB_USERNAME"
|
|
|
|
git clone "https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
|
|
|
|
2020-03-29 09:20:35 -06:00
|
|
|
# Copy files into the git and deletes all git
|
2020-03-29 09:07:19 -06:00
|
|
|
cd "$CLONE_DIR"
|
|
|
|
# find needs to be in the git repository directory
|
|
|
|
find . | grep -v ".git" | grep -v "^\.*$" | xargs rm -rf # delete all files (to handle deletions)
|
|
|
|
cp -r "../$FOLDER"/* .
|
|
|
|
|
|
|
|
git add .
|
|
|
|
git commit --message "Update from $GITHUB_REPOSITORY"
|
|
|
|
git push origin master
|