Skip to content

Commit

Permalink
updated travis and build.sh. Added docker deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
Xumeiquer committed Feb 20, 2019
1 parent b5aef5e commit 70c67b4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ script:
- go get -t -v ./...
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

after_success:
- ./scripts/deploy_to_docker.sh

before_deploy:
- ./build.sh

Expand All @@ -25,4 +28,7 @@ deploy:
skip_cleanup: true
overwrite: true
on:
tags: true
tags: true

notifications:
webhooks: https://${TGWH_USER}:${TGWH_PASS}@tgwh.goca.io/travisci
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ do
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
else
sha256sum $build_dir$output_name > $build_dir$output_name.sha256
fi
done
21 changes: 21 additions & 0 deletions scripts/deploy_to_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "We're not on the master branch."
exit 0
fi

if [[ "$TRAVIS_TAG" == "" ]]; then
echo "We're not in a release."
exit 0
fi

export REPO=gocaio/goca
export TAG=$TRAVIS_TAG
export COMMIT=${TRAVIS_COMMIT::8}

docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker build -f Dockerfile -t $REPO:$COMMIT .
docker tag $REPO:$COMMIT $REPO:latest
docker tag $REPO:$COMMIT $REPO:$TAG
docker push $REPO

0 comments on commit 70c67b4

Please sign in to comment.