Last active
December 18, 2017 01:00
-
-
Save caarlos0/6366804 to your computer and use it in GitHub Desktop.
Continous deploy with Jenkins and Heroku. This is the post-build script.
This file contains hidden or 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
#!/bin/bash | |
# | |
# login in the jenkins server with: | |
# | |
# heroku login | |
# heroku keys:add | |
# | |
# Doing so, jenkins will have permission to deploy to | |
# the heroku remote. | |
# | |
# exit 1 on errors | |
set -e | |
# deal with remote | |
echo "Checking if remote exists..." | |
if ! git ls-remote heroku; then | |
echo "Adding heroku remote..." | |
git remote add heroku [email protected]:PROJECT.git | |
fi | |
# push only origin/master to heroku/master - will do nothing if | |
# master doesn't change. | |
echo "Updating heroku master branch..." | |
git push heroku origin/master:master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment