This repository has been archived by the owner on Jul 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.travis.yml
58 lines (52 loc) · 1.96 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
language: java
jdk: oraclejdk8
sudo: required
cache:
directories:
- $HOME/.m2
services:
- docker
before_install:
- wget https://github.com/jwilder/dockerize/releases/download/v0.6.0/dockerize-linux-amd64-v0.6.0.tar.gz
- tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz
- rm dockerize-linux-amd64-v0.6.0.tar.gz
- ./dockerize -template vendor/docker/database.properties.tmpl:src/main/resources/database.properties
- ./dockerize -template vendor/docker/log4j.properties.tmpl:src/main/resources/log4j.properties
script:
- mvn clean test
after_success:
# - set -e
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
- REPO=datacite/oaip;
- AUTO_DEPLOY=false;
- if [ "${TRAVIS_TAG?}" ]; then
docker build -f Dockerfile -t $REPO:$TRAVIS_TAG .;
docker push $REPO:$TRAVIS_TAG;
echo "Pushed to" $REPO:$TRAVIS_TAG;
AUTO_DEPLOY=true;
elif [ "$TRAVIS_BRANCH" == "master" ]; then
docker build -f Dockerfile -t $REPO .;
docker push $REPO;
echo "Pushed to" $REPO;
AUTO_DEPLOY=true;
else
docker build -f Dockerfile -t $REPO:$TRAVIS_BRANCH .;
docker push $REPO:$TRAVIS_BRANCH;
echo "Pushed to" $REPO:$TRAVIS_BRANCH;
fi
- if [ "$AUTO_DEPLOY" == "true" ]; then
export GIT_SHA=$(git rev-parse --short HEAD);
export GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1));
git clone "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/${TERRAFORM_REPO}.git";
./dockerize -template vendor/docker/_oaip.auto.tfvars.tmpl:${TERRAFORM_REPO}/_oaip.auto.tfvars;
cd ${TERRAFORM_REPO};
git remote;
git config user.email ${DOCKER_EMAIL};
git config user.name ${DOCKER_USERNAME};
git add _oaip.auto.tfvars;
git commit -m "Adding oaip git variables for latest commit";
git push "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/${TERRAFORM_REPO}.git" master;
fi
notifications:
slack: datacite:Wt8En0ALoTA6Kjc5EOKNDWxN
email: false