Created
July 27, 2016 19:16
-
-
Save shanestillwell/bbe3ef0761258731f8fd48a383a104f6 to your computer and use it in GitHub Desktop.
Publish my git/docker code
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
#!/bin/bash | |
IMAGE_NAME=registry.gitlab.com/shanestillwell/goscouter-api; | |
CURR_COMMIT=$(git rev-parse HEAD); | |
CURR_VERSION=$(node -e "console.log(require('./package.json').version);"); | |
VER_HASH=$(git rev-list -n 1 v$CURR_VERSION); | |
# Don't want to redo version bump | |
if [ $CURR_COMMIT == $VER_HASH ] | |
then | |
echo 'Already up to date' | |
exit | |
fi | |
npm version patch; | |
NEW_VERSION=$(node -e "console.log(require('./package.json').version);"); | |
echo $NEW_VERSION; | |
docker build -f Dockerfile.prod -t $IMAGE_NAME .; | |
BUILD_ID=$(docker images -q $IMAGE_NAME:latest); | |
docker tag $BUILD_ID $IMAGE_NAME:$NEW_VERSION | |
docker push registry.gitlab.com/shanestillwell/goscouter-api:$NEW_VERSION | |
git push origin head; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment