-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.travis.yml
64 lines (61 loc) · 4.07 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
git:
depth: 3
sudo: required
services:
- docker
env:
global:
- DOCKER_REPO=cadasta/zipstream
- GIT_REPO=$DOCKER_REPO
- DOCKER_TAGGED_REPO=$DOCKER_REPO:${TRAVIS_BRANCH//\//.} # Replace slashes with periods
# DOCKER_USERNAME
- secure: CM/uUNVWMidna83BB+nnfe90h5u8fSxF/rFr+fr6DZK6fjnrq8/N5v6l+VvFGsNlxq66uLB5wYa3u7zQyvMP76YnbqNzZcunGd0q5YAZ/mIQXioqosxtx8tlYGDtr8JLuI2SQR0G/a3XYp9g9fEWABM3qoD3rMY4SiXBK1i4UL+CrxegfiifTSkMybH6paFcrhR4qwe7oJuuRPEdNOVfu77/+HRh8yP/uEpk41vVSNWL25bJsF4T4ej/r4MjhCqkuOsJXFGq0oEjcnPcq9sMruiR1Y9PbmhPJjNY0HyTS6aEBlsb8yRJ+519FkiM+2TPAXDxi62CxojSDjhTzu2EBkwmjuLWaH3LLrUfyVu1V3V41TTlGIYmYeE53pgFkkimRTEhWCtSPrsZbrfiZFs3g+HvS0tH7nyaru6Lx4a1yvsQzC42YqyxvrcNn3J3yhvPCywDv7jdtoVBDy8JoZT5OXSdFGX483LJNigszTJg7xDt0j81QUQS/Tb39agsiY4Aslwnlc7EIa4bgqos1eSfmGQOBX6KyfvGA/pUAJ5FnDeXj/qh/Qr5c5b0knCVhD75MpkWBr2JzPf4e07BQsxb9VQC1gF80EpZRn+db+dn8uKRbrA4VABAVi0olBDqOKaEK9Ect3QuFJiGYziGM+IHD4ZpylD7DxYmkUBSoMcAQhc=
# DOCKER_PASSWORD
- secure: PzsPaWJenXFygE4CC7fls5v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nMw/EytOp8pP1fbnIOHgoDlTSt4lVFiZjisJkW6xANFIfyriknhfdIpqZpargtEPOF1Ywsk1T2pdbVP3Hh2oOR2bPkafmWrfCvFcw676QXFbkEYMt4b11zWYvZki0sHTq9EMhRFdiiukpePp5BrJeMCLGLpTNX0TResJkCuNd1fryBI8WBcUWDqLyYBOJdgKFbK5NQfx9f+Z74tAi/tg+GRjopRsmt4yxoSv4KtlcgwdawkAaCZMzrj7etchCkpiqlZHCDuXLu9W2NhUe5WwvVwkrM=
before_install:
# Upgrade Docker
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
install:
- echo "Building $DOCKER_TAGGED_REPO ($TRAVIS_COMMIT)"
- docker pull $DOCKER_TAGGED_REPO || docker pull $DOCKER_REPO:master || docker pull $DOCKER_REPO || true
- docker build --cache-from $DOCKER_TAGGED_REPO -t $DOCKER_TAGGED_REPO .
script:
# Test
- docker run -t $DOCKER_TAGGED_REPO yarn test:coverage
- docker run -t $DOCKER_TAGGED_REPO yarn lint
after_success:
# Push to docker
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker push $DOCKER_TAGGED_REPO;
# Read version
- |
if [ $TRAVIS_BRANCH == "master" ]; then
export VERSION=$(docker run -t $DOCKER_TAGGED_REPO ./getversion);
echo "Tagging with version: $VERSION";
fi
- if [ $TRAVIS_BRANCH == "master" ]; then
docker tag $DOCKER_TAGGED_REPO $DOCKER_REPO;
docker push $DOCKER_REPO;
fi
# Tag docker build w/ latest and version
- |
if [ $TRAVIS_BRANCH == "master" ]; then
if curl --head --fail "https://hub.docker.com/v2/repositories/${DOCKER_REPO}/tags/${VERSION}/"; then
echo "Tag ${VERSION} already exists on Docker, not tagging with version..."
else
docker tag $DOCKER_TAGGED_REPO $DOCKER_REPO:$VERSION;
fi
docker tag $DOCKER_TAGGED_REPO $DOCKER_REPO:latest;
docker push $DOCKER_REPO;
fi
# Tag git repo with version
- |
if [ $TRAVIS_BRANCH == "master" ]; then
git config --global user.email "[email protected]";
git config --global user.name "Travis CI";
git tag $VERSION -a -m "Generated tag from TravisCI build $TRAVIS_BUILD_NUMBER";
git push --tags https://${GITHUB_TOKEN}@github.com/${GIT_REPO}.git;
fi