2019-05-17 10:50:48 +00:00
|
|
|
#! /bin/sh
|
2019-05-17 11:06:36 +00:00
|
|
|
set -efu
|
|
|
|
exec >&2
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
hosts_srcdir=$GITHUB_HOST_SYNC_SRCDIR
|
|
|
|
hosts_worktree=${GITHUB_HOST_SYNC_WORKTREE-/tmp/hosts}
|
|
|
|
hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebscode/hosts.git}
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
test -d "$hosts_worktree" || git clone "$hosts_url" "$hosts_worktree"
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
cd "$hosts_worktree"
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
git pull
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
rsync \
|
|
|
|
--chmod D755,F644 \
|
|
|
|
--delete-excluded \
|
|
|
|
--filter 'protect .git' \
|
|
|
|
--recursive \
|
|
|
|
--verbose \
|
|
|
|
"$hosts_srcdir/" \
|
|
|
|
.
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
git add .
|
2019-05-17 10:50:48 +00:00
|
|
|
|
2019-05-17 11:06:36 +00:00
|
|
|
if test -n "$(git status --porcelain)"; then
|
|
|
|
git config user.email "$LOGNAME@$(hostname)"
|
|
|
|
git config user.name "$LOGNAME"
|
|
|
|
git commit -m bump
|
|
|
|
git push
|
|
|
|
fi
|