Last active
December 18, 2015 16:59
-
-
Save doug/5815381 to your computer and use it in GitHub Desktop.
Poll git repo and deploy to app engine when git hooks are not possible.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# iterate through all git repos in projects folder | |
# fetch for any changes to remote | |
# for each branch, if it is different pull the changes and deploy | |
echo "Starting" | |
while true; do | |
for project in $(ls projects); do | |
echo "Checking for updates to $project" | |
cd "projects/$project" | |
branches=$(git remote -v update 2>&1 | grep -oEi "^\W+.*\w+$" | grep -v "up to date" | grep -oEi "\w+$") | |
for branch in $branches; do | |
echo "updating $branch" | |
git checkout $branch | |
git pull --rebase origin $branch | |
echo "rename app.yaml" | |
cp app.yaml app.copy.yaml | |
version=$(echo $branch | sed 's/\//-/g') | |
sed "s/version: auto-set-by-branchname/version: $version/g" app.copy.yaml > app.yaml | |
appcfg.py --oauth2 update . | |
rm -f app.yaml | |
mv app.copy.yaml app.yaml | |
done | |
cd ../.. | |
done | |
echo "Sleeping for 3 minutes" | |
sleep 180 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment