2018-07-19 05:59:07 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Exit immediately if a command returns a non-zero status.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Set git credentials
|
2019-01-25 16:26:52 -05:00
|
|
|
git config --global user.email "$GIT_EMAIL"
|
|
|
|
git config --global user.name "$GIT_USERNAME"
|
2018-07-19 05:59:07 -04:00
|
|
|
|
|
|
|
# let git know where to apply the changes
|
|
|
|
git checkout master
|
|
|
|
|
2018-07-20 14:10:58 -04:00
|
|
|
echo "Adding data files"
|
2018-07-19 05:59:07 -04:00
|
|
|
git add data/*
|
|
|
|
|
2018-07-20 14:10:58 -04:00
|
|
|
echo "Checking the number of files staged"
|
|
|
|
files=$(git diff --cached --numstat | wc -l | tr -d '[:space:]');
|
|
|
|
[[ $files -eq 0 ]] && echo "nothing to push, exiting..." && exit
|
2018-07-19 05:59:07 -04:00
|
|
|
|
2018-07-20 14:10:58 -04:00
|
|
|
echo "Commiting files"
|
2019-01-25 16:26:52 -05:00
|
|
|
git commit -m "Automated update repository metadata [skip-ci]"
|
2018-07-20 14:10:58 -04:00
|
|
|
|
|
|
|
echo "Pushing changes"
|
2019-01-25 16:26:52 -05:00
|
|
|
git push https://"$GIT_USER:$GITHUB_TOKEN"@github.com/veggiemonk/awesome-docker master >/dev/null 2>&1
|
2018-07-19 05:59:07 -04:00
|
|
|
|
2018-07-20 14:10:58 -04:00
|
|
|
echo "Done."
|