-
Notifications
You must be signed in to change notification settings - Fork 25
/
.travis.yml
67 lines (62 loc) · 3.03 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
65
66
67
sudo: required
env:
global:
- RELEASE_BRANCH=master
- TEMP_DOCKER_TAG=pg2k4j
services:
- docker
language: java
jdk:
- openjdk11
cache:
directories:
- ~/.m2/repository
git:
# The --depth option is used by default, which implies --single-branch.
# The result of this is ONLY the current bbranch/tag is cloned.
# This means you can't checkout or fetch other branches. The loe restores "normal" behaviour
depth: false
before_install:
## export GPG details
- echo $GPG_SECRET_KEYS | base64 --decode | gpg --import
script:
- mvn --settings .maven.xml clean install jacoco:report -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
- bash <(curl -s https://codecov.io/bash)
before_deploy:
# Switch to the release branch (master)
# bump the version according to the tag, commit, push then deploy to sonatype
# When we change the version we use a temp branch which is then merged in to the release branch
# We do this to avoid switching branches mid build
- git config --global user.email "travis@travis-ci.com"
- git config --global user.name "Travis CI"
- git fetch
- mvn versions:set -DnewVersion=${TRAVIS_TAG}
- git checkout -b ${TRAVIS_TAG}-temp
- git commit -am "Bump Version to ${TRAVIS_TAG}"
- # Merge local (.) temp branch into local release branch,
- git fetch . ${TRAVIS_TAG}-temp:$RELEASE_BRANCH
- git push https://${GH_TOKEN}@github.com/disneystreaming/pg2k4j.git $RELEASE_BRANCH:$RELEASE_BRANCH
- mvn clean deploy --settings .maven.xml -DskipTests=true -U -P release
deploy:
# Add the jar to the git release
provider: releases
api_key:
secure: YZgQtvlss2hovlNXCjrgdspCZIBdAeBI8HAsMkfOcTJQb9uuMfcD8YF9s/34EBRSJSvIYvCBat3f50Bm7p/qsjcxvGdwpd9dnh5jlc+K63jWsTzsYQbgnjHZxrC/Xsg05M22e/7AkmTAzt8OnDi+kgUn6Zxjj2B/WxAHY3GSWXtGGF1Yyl2flodtLcA8KbfGLFUEObmadNkJRiAdrEQ3xoDV2f3hYKl1tw2U/EDhEmlwIKKXKao8VAYIHJ0/5qmfDdHzvrAVwWLEHR3ANpop4lcAtU5u2UpfKqAZ0M1EuSepVWbgBIekI5b5VyilGAe7h+8P6KA3Ej6KMOOoPy/Qz0XMJIWcBfMJZOvOh5j2LY4aDsY0FmWiY0n50GWvMTw0VwY3uLHWCrj2Q2qGK7HIWO1wriZZPuAT6apRsDavfWhE3IiC1Kh2JOYMYaCNxOKPe5wHZZZrCRf3dqCl6jreO0WhpM/rBt0wVGyomN77+rifsfO9MZeSX1WHFtjyr77a74j6Wbi6IvJDvs6uLQiU4xa/pnmZyTq/9Vm/UPho0kGUL2cHZISfxA4AFb+WQuB3LZ4DJNHCPikZP39sSu0hEWoXQtmGqBmJMenGwaRMVIjX4KbZUN/ebKa4egMM2nlMldC9qU+8C4DG7ofNuOhjLzPEi6nq1J5CBOq8rdSeYtI=
file:
- target/pg2k4j-${TRAVIS_TAG}.jar
skip_cleanup: true
on:
# Only deploy when the release branch is tagged with a version (x.x.x)
repo: disneystreaming/pg2k4j
tags: true
branch: $RELEASE_BRANCH
condition: $TRAVIS_TAG =~ ^([0-9]+.[0-9]+.[0-9]+)-?(.*)?$
after_deploy:
# Publish the docker image
# We can't use automated DH builds because we need the target directory from the build
- docker build --build-arg version=$TRAVIS_TAG . -t ${TEMP_DOCKER_TAG}
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker tag $TEMP_DOCKER_TAG disneystreaming/pg2k4j:latest
- docker tag $TEMP_DOCKER_TAG disneystreaming/pg2k4j:$TRAVIS_TAG
- docker push disneystreaming/pg2k4j:latest
- docker push disneystreaming/pg2k4j:$TRAVIS_TAG