dsp/autoupdate

26 lines
517 B
Text
Raw Normal View History

2015-10-18 23:06:39 -07:00
#!/usr/bin/env zsh
set -e
2016-04-23 20:12:55 -07:00
[ -d lib ] && rm -r lib
2015-12-04 02:20:37 -08:00
dropbox_uploader -q download py/lib >/dev/null
2015-10-18 23:06:39 -07:00
2017-09-25 09:03:47 -07:00
mv lib/README.md .
2017-09-25 09:02:30 -07:00
2015-10-18 23:06:39 -07:00
if [ ! -d .git ]; then
2015-10-19 05:49:28 -07:00
git -q init
2015-10-18 23:06:39 -07:00
git add .gitignore '*' '**/*'
else
2015-10-19 05:39:37 -07:00
git add -A
2015-10-18 23:47:00 -07:00
changes="$(git status --porcelain | wc -l)"
[ "$changes" -eq 0 ] && exit 0
2015-10-18 23:06:39 -07:00
fi
2015-12-04 02:20:37 -08:00
version="$(git log --oneline | wc -l)"
2015-10-18 23:06:39 -07:00
let version++ || true # -e mode doesn't like this normally
2015-10-19 05:49:28 -07:00
git commit -qm "update $version" . >/dev/null
2015-10-19 05:47:32 -07:00
2015-10-19 05:53:43 -07:00
if git remote | grep -Fxq origin; then
git push -q origin master
fi