forked from jpmorganchase/sandboni-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
77 lines (68 loc) · 2.86 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
68
69
70
71
72
73
74
75
76
77
dist: trusty
language: java
jdk: openjdk8
install: true
jobs:
include:
- stage: sonar
if: repo = jpmorganchase/sandboni-core
name: "PR: mvn clean verify sonar:sonar"
script:
- mvn clean verify sonar:sonar
# after_success:
# - source ./scripts/breakbuild.sh
- stage: release
if: repo = jpmorganchase/sandboni-core AND branch = master AND type = push
name: "Release: Tag on GitHub and deploy to OSSRH"
jdk: oraclejdk8
script:
- head_ref=$(git rev-parse HEAD) || travis_terminate 1
- branch_ref=$(git rev-parse "$TRAVIS_BRANCH") || travis_terminate 1
- |
if [[ $head_ref != $branch_ref ]]; then
echo "HEAD ref ($head_ref) does not match $TRAVIS_BRANCH ref ($branch_ref). New commits may have been pushed before the build cloned the repo"
return 0
fi
- git checkout $TRAVIS_BRANCH || travis_terminate 1
- release_version=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
- branch_name="release-${release_version}"
# prepare current branch for release, create release branch, increment development version on current branch
- mvn --settings .maven.xml -B -DbranchName=${branch_name} release:branch || travis_terminate 1
- git checkout $branch_name || travis_terminate 1
# remove SNAPSHOT version suffix, create a tag in GitHub, increment development version on release branch
- mvn --settings .maven.xml -B -DpushChanges=true release:prepare || travis_terminate 1
# check out tag from GitHub, build then deploy to OSSRH
- echo $GPG_SECRET_KEYS | base64 --decode | gpg --import
- echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust
- mvn --settings .maven.xml -B release:perform || travis_terminate 1
- stage: snapshot release
if: repo = jpmorganchase/sandboni-core AND branch = dev AND type = push
name: "SNAPSHOT release"
before_install:
- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
before_deploy:
- mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
- export project_version=$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
script:
- mvn clean deploy -DskipTests=true --settings .maven.xml -B -U -Prelease
deploy:
provider: releases
api_key:
secure: "$GITHUB_TOKEN"
file:
- target/sandboni-*.jar
skip_cleanup: true
on:
repo: jpmorganchase/sandboni-core
tags: true
addons:
sonarcloud:
organization: "sandboni"
token: "$SONAR_TOKEN"
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'
git:
depth: false