-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17442b2
commit 95f8e88
Showing
4 changed files
with
42 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# Deploy container to a Heroku. | ||
# You need to specify $HEROKU_API_KEY before using this script. | ||
|
||
# Find mix.exs inside project tree. | ||
# This allows to call bash scripts within any folder inside project. | ||
PROJECT_DIR=$(git rev-parse --show-toplevel) | ||
if [ ! -f "${PROJECT_DIR}/mix.exs" ]; then | ||
echo "[E] Can't find '${PROJECT_DIR}/mix.exs'." | ||
echo " Check that you run this script inside git repo or init a new one in project root." | ||
fi | ||
|
||
# Extract project name and version from mix.exs | ||
PROJECT_NAME=$(sed -n 's/.*app: :\([^, ]*\).*/\1/pg' "${PROJECT_DIR}/mix.exs") | ||
PROJECT_VERSION=$(sed -n 's/.*@version "\([^"]*\)".*/\1/pg' "${PROJECT_DIR}/mix.exs") | ||
|
||
echo "Logging in into Heroku"; | ||
heroku plugins:install heroku-container-registry | ||
heroku login | ||
heroku container:login | ||
|
||
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then | ||
if [ "$TRAVIS_BRANCH" == "$RELEASE_BRANCH" ]; then | ||
docker tag "${PROJECT_NAME}:${PROJECT_VERSION}" "registry.heroku.com/${PROJECT_NAME}/web" | ||
fi; | ||
|
||
if [[ "$MAIN_BRANCHES" =~ "$TRAVIS_BRANCH" ]]; then | ||
docker push "registry.heroku.com/${PROJECT_NAME}/web" | ||
fi; | ||
fi; |
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
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