Skip to content
This repository was archived by the owner on Sep 15, 2020. It is now read-only.

Commit 9b37ead

Browse files
committed
Introduce Travis releases
1 parent fdda24e commit 9b37ead

File tree

6 files changed

+129
-6
lines changed

6 files changed

+129
-6
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
*.xml text
77
*.yaml text
88
*.yml text
9+
*.enc binary

.travis.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,35 @@ language: java
33
jdk:
44
- oraclejdk8
55

6-
env:
7-
global:
8-
- secure: "RyEaEKa8dqco4MmEiEx7ka4c/QXYRHJQKVAyO2c9riDHlGQEp1gvlvO+62leZOOKiJhGARbSwbZN2kKdG22V0Hu49tEW1TKEdcZ+F0s9SrCf8QdEMzLAWQePIojZvzS67ggEAPPS5xmLujpWT1eyhXz93qJz08ShgTX0eLhgw8VE1/6+ucgPNK9KHDppYcgKfY2uOwp+2mwj+ltcWT/az3ky6TM4TTxhyNE2pSIKYBpxe3Ga3Hd31MzNolhsdzZvL1pPexEpUt+4Ps4SRXotUjmkM1zS8/pbQZ6HC1dGj0AVUbeyUVKEaoV9lhMFFT7PKSktAjw9FNpS1F6NsPbvQvBqt42k05QWwu1OoJQixFsPWb0klW7I7YQyHHUZexh0wQPf7drlw+kho4CXPFLbERMVw1X4TSyOalUuoBcKaiH8ZQL2rVYf9bMVF7YIw9aUfvPYYWLbboDRd3ln1TPiGywCGShWg6ubKB7ZxEtYQr23JHbWM2VlF3ddOwrRa1++L8ut/9yV2aj/WOT8Al/SiMYQ/4bhQSEQlTrpPRsj//ECltfyRHoWxVR9jWhRhz0VbrYueNGHZ9dR4d1t0VkydyfqWHSk1KGW34YYm86zAL0NnXxrK/Irck5K7STRs3oK9UEYVcbO1Pd45mWx+y/mdD8TRg318rqlEb4WJ5rWrF4="
9-
- secure: "Il4G1ShT8971ThTwTHwrZHuV/XTwIufe4ZBcj7t+LSclikXxgsDPY83GSDeMVBihn6ZLDkT3V0PvTRT6XqwOprrSeBvAGng+nR4/iazZfrxcMHqLUQzu6w6UQLT5LT+L8ofRC8hFeRhcf704gtaIn44BI5IlKAFBqacYymEEFWC3W9FpvrYKAXvmhnmmIg5A/JGiTbGjENcV3evaENPBYbGtI8d80cqWfofg+RodJzgFBzslw4dtuiwWJWMHmWzRQi/6M53tx8OmJyd7YavInXc9KaaJvwcF2n/9AzF26tSlzKu9I3V01+k0wWVvXnMsC/PYP4Kx6MboRwoDNm2firOF0oI/HB6fs4Wvg/IjBo0JFnqwmypJerWicZ6SKWo6l0oplJg3FrX18UjsJqCnjxCXJjgavcLooOR+omVvvdK9Nt4eGo/K5YVemOmi45FlAiO9omVo1E5yEemg27ArQC9x+J7W6ISXAT9E5VotBFWt/Bl+bhnkf5OO/y51x2jIIETZ4QVIpSXFFcWvkemefjnwrg30I+ud4HchQUbAA2MVDFSYFC18D88p9aVXcVbXKAjEzm1LxcErdQ5e4AOu1Eajj/EFDUpol9dvESQKgFqhWr8ykmsxKi/K+izziF0CKEGwQJfzT5Dze+QkqJ3TAt57BEdKr0ckTEkawrYvdUo="
6+
stages:
7+
- name: test
8+
if: not branch =~ ^release/.*$ AND not branch =~ ^tmp/.*$
9+
- name: publish
10+
if: branch =~ ^release/.*$ AND not branch =~ ^tmp/.*$
1011

1112
before_cache:
1213
# No sense in caching current build artifacts
1314
rm -rf $HOME/.m2/repository/org/postgresql
1415

16+
before_install:
17+
- test -d "${JDK6_HOME}" || export JDK6_HOME=$(jdk_switcher home openjdk6)
18+
- test -d "${JDK7_HOME}" || export JDK7_HOME=$(jdk_switcher home openjdk7)
19+
- test -d "${JDK8_HOME}" || export JDK8_HOME=$(jdk_switcher home oraclejdk8)
20+
- test -d "${JDK9_HOME}" || export JDK9_HOME=$(jdk_switcher home oraclejdk9)
21+
- test -d "${JDK9_HOME}" || export JDK9_HOME=$(jdk_switcher home oraclejdk8) # JDK9 missing on precise, fallback to JDK8
22+
- envsubst < .travis/toolchains.xml > ~/.m2/toolchains.xml
23+
1524
cache:
1625
directories:
1726
- '$HOME/.m2/repository'
1827

28+
matrix:
29+
include:
30+
- stage: test
31+
- stage: publish
32+
install: true # skip mvn install
33+
script: .travis/deploy.sh
34+
1935
# Deploy snapshots to Maven Central
2036
after_success:
21-
- "[[ $TRAVIS_BRANCH == 'master' ]] && mvn clean deploy --settings settings.xml"
37+
- "[[ $TRAVIS_BRANCH == 'master' ]] && mvn clean deploy --settings .travis/settings.xml"

.travis/deploy.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
# Fail script on error
4+
set -e
5+
6+
cd .travis
7+
mkdir secrets
8+
9+
# GPG is required for artifact signing
10+
openssl aes-256-cbc -k "$SUPER_SECRET_KEY" -in secrets.tar.enc -out secrets/secrets.tar -d
11+
12+
cd secrets
13+
tar xvf secrets.tar
14+
15+
gpg --import gpg-secret.key
16+
gpg --import-ownertrust gpg-ownertrust
17+
18+
# Decrypt GitHub SSH key
19+
chmod 600 github_deploy
20+
eval $(ssh-agent -s)
21+
ssh-add ./github_deploy
22+
23+
cd ..
24+
rm -rf ./secrets
25+
26+
cd ..
27+
28+
git config --global user.name "pgjdbc CI"
29+
git config --global user.email "[email protected]"
30+
31+
# By default Travis checks out commit, and maven-release-plugin wants to know branch name
32+
# On top of that, maven-release-plugin publishes branch, and it would terminate Travis job (current one!),
33+
# so we checkout a non-existing branch, so it won't get published
34+
# Note: at the end, we need to update "master" branch accordingly" (see $ORIGINAL_BRANCH)
35+
TMP_BRANCH=tmp/$TRAVIS_BRANCH
36+
git checkout -b "$TMP_BRANCH"
37+
38+
# Remove tmp branch if exists
39+
git push [email protected]:$TRAVIS_REPO_SLUG.git ":$TMP_BRANCH" || true
40+
41+
set -x
42+
# -Darguments here is for maven-release-plugin
43+
MVN_SETTINGS=$(pwd)/.travis/settings.xml
44+
mvn -B --settings .travis/settings.xml -Darguments="--settings '${MVN_SETTINGS}'" release:prepare release:perform
45+
46+
# Point "master" branch to "next development snapshot commit"
47+
ORIGINAL_BRANCH=${TRAVIS_BRANCH#release/}
48+
git push [email protected]:$TRAVIS_REPO_SLUG.git "HEAD:$ORIGINAL_BRANCH"
49+
# Removal of the temporary branch is a separate command, so it left behind for the analysis in case "push to master" fails
50+
git push [email protected]:$TRAVIS_REPO_SLUG.git ":$TMP_BRANCH"

.travis/secrets.tar.enc

13 KB
Binary file not shown.

settings.xml renamed to .travis/settings.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
55
<servers>
66
<server>
7-
<!-- Deploy only snapshots from Travis -->
7+
<id>ossrh</id>
8+
<username>${env.SONATYPE_USERNAME}</username>
9+
<password>${env.SONATYPE_PASSWORD}</password>
10+
</server>
11+
<server>
812
<id>ossrh-snapshots</id>
913
<username>${env.SONATYPE_USERNAME}</username>
1014
<password>${env.SONATYPE_PASSWORD}</password>

.travis/toolchains.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF8"?>
2+
<toolchains>
3+
<!--
4+
JDK toolchains to be used to build PgJDBC for JRE6 or JDR7.
5+
Note: in order to release PgJDBC, you need all three JDK to be set via toolchains.
6+
The file should be placed to ~/.m2/toolchains.xml
7+
8+
Default locations are:
9+
Mac OS: /Library/Java/JavaVirtualMachines/jdk1.7.0_XY.jdk/Contents/Home
10+
Ubuntu: /usr/lib/jvm/java-7-openjdk-amd64
11+
-->
12+
<toolchain>
13+
<type>jdk</type>
14+
<provides>
15+
<version>1.6</version>
16+
<vendor>oracle</vendor>
17+
</provides>
18+
<configuration>
19+
<jdkHome>${JDK6_HOME}</jdkHome>
20+
</configuration>
21+
</toolchain>
22+
<toolchain>
23+
<type>jdk</type>
24+
<provides>
25+
<version>1.7</version>
26+
<vendor>oracle</vendor>
27+
</provides>
28+
<configuration>
29+
<jdkHome>${JDK7_HOME}</jdkHome>
30+
</configuration>
31+
</toolchain>
32+
<toolchain>
33+
<type>jdk</type>
34+
<provides>
35+
<version>1.8</version>
36+
<vendor>oracle</vendor>
37+
</provides>
38+
<configuration>
39+
<jdkHome>${JDK8_HOME}</jdkHome>
40+
</configuration>
41+
</toolchain>
42+
<toolchain>
43+
<type>jdk</type>
44+
<provides>
45+
<version>1.9</version>
46+
<vendor>oracle</vendor>
47+
</provides>
48+
<configuration>
49+
<jdkHome>${JDK9_HOME}</jdkHome>
50+
</configuration>
51+
</toolchain>
52+
</toolchains>

0 commit comments

Comments
 (0)