Skip to content

Commit 976e9b0

Browse files
committed
deploy to Sonatype OSSRH from Travis CI
add maven artifact signing certificates and travis CI config. this actually only contains a signing sub-certificate, encrypted with a different passphrase than the master key, and then encrypted again with 'travis encrypt-file', following the excellent instructions at http://www.debonair.io/post/maven-cd/
1 parent 27202e3 commit 976e9b0

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

.travis.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: java
2-
3-
# OpenTripPlanner requires Java 8 and Travis doesn't (yet) support OpenJDK 8
2+
# OpenTripPlanner requires Java 8 and Travis doesn't (yet) support OpenJDK 8
43
jdk:
54
- oraclejdk8
6-
5+
76
# Replace Travis's default Maven installation step with a no-op.
87
# This avoids redundantly pre-running 'mvn install -DskipTests' every time.
98
install: true
@@ -13,27 +12,33 @@ install: true
1312
script: |
1413
# only (attempt to) deploy non-pull request commits to master
1514
if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then
16-
mvn clean deploy
15+
mvn clean deploy --settings maven-settings.xml
1716
else
1817
# otherwise, just run test suite
19-
mvn clean verify
18+
mvn clean verify --settings maven-settings.xml
2019
fi
2120
21+
# Secure envs are OSSRH_JIRA_USERNAME, OSSRH_JIRA_PASSWORD, GPG_KEY_NAME, GPG_PASSPHRASE
2222
env:
2323
global:
24-
# encrypted AWS access/secret keys to allow automated deployment to the Conveyal Maven repo on S3
25-
- secure: "d1GabNiRYJwCeu+Zqr/qKnyNf4CY2pH0dLkY708Dzpe1Vgi0k2WLTMeYe9yJ3CyQydpUfOFkvwV64r4KIj4tBRDuW5C72bZyk/0o6oo931IwT1uHKstPfiovf/GiZ8qbn0SDencwfjfDefZUtaZ6I1mF6S638PvUlz4lNgl6kfA="
26-
- secure: "DNnCaMx4Cgcuj78m96IEDwZMMtY14HCWIi6voT80DJZB5Rtu50BayT8ljxjrSHATYIfkZ+aLgFaNSPqI8MlNlt22xk2lzjOkA4J3Bn0d3xuYlgS9WT5rh78llKgtGpjH47OeRwHhpFM5PnNTCgFdnXNoj9SlZeNlWHk8+PHi5do="
24+
- secure: SR50xh5n9H9ML20NM9QK3Y7rS1xzmMgLtp8Hke7fPL4QsCvdd1CTXTIjGPtCNzvEx0zUKIx1vO0s5mwnB0KyhTzwI8t5xvw7RErp7v7WiskKVKVkCu6EPDsTH1d3iQpF4QAFy/07HehCvGtObh3XnOYZKRfoxpY3/n9y/DxuKp8=
25+
- secure: R8kd55l4UXde9pa6POKFFFmkp4N7KD03vCAiT5dEOvDDKBRIGo1n7Yn+txIhpe8VJVYDqAxOUdW9yZO29GWvjNTiFmDqbvC4GuzWqU+Am1Dfmi5Udmmswcy4CTeoNqKchhNn69EhphdFsKE+JzCZIJSo4+Gl0jAqxMBE13ghlBw=
26+
- secure: LV+MX/r5l/ycNS1fQNxdzBLyGLnAsG8G3APWsvqb0Sou/fPncwjfGV178jxPUULhb8VAex+MIJsBObrQGD4vdvqBI9ASPHReplANLYrsAAzTm0bPkkyQCs37cDq9ORsETnR9j8m8G/0+8bxH81WOOEv56h4fiQog5z3cBbSGdh0=
27+
- secure: cAXIX+Op0EXl3GHX5qCOGHrFQpPlvVSq8mh5zqABSICsMQHUgTyOgSNUykOdrOarjM2y2H1+Yu2MfLtu2v1hAS/zSzAswx+7T7xwptsX1bd+QX2s9+3q4OgG/97Il3Dqhbf9mGqxJyfWP4iD1Ry9IIlsIGk/coe877mkZCbKb2s=
2728

2829
# If sudo is disabled, CI runs on container based infrastructure (allows caching &c.)
2930
sudo: false
3031

3132
# Retain the local Maven repository to speed up builds.
3233
cache:
3334
directories:
34-
- "$HOME/.m2/repository"
35+
- $HOME/.m2/repository
3536

36-
# Notify us of the build status on the Slack channel
37+
# Notify us of the build status on the Slack channel
3738
notifications:
3839
slack: conveyal:RQuTZBfE7FBjVtYkKwdnNRjY
3940

41+
# Decrypt and import the artifact signing certificate before running the build
42+
before_install:
43+
- openssl aes-256-cbc -K $encrypted_9918733fe303_key -iv $encrypted_9918733fe303_iv -in maven-artifact-signing-key.asc.enc -out maven-artifact-signing-key.asc -d
44+
- gpg --import --batch maven-artifact-signing-key.asc

maven-artifact-signing-key.asc.enc

5.56 KB
Binary file not shown.

maven-settings.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!-- This file provides passwords and key details to the Maven plugins that sign our artifacts
2+
and deploy them to the OSSRH repository. The secret information is passed in with
3+
Travis CI secure environment variables in .travis.yml. -->
4+
<settings>
5+
<servers>
6+
<server>
7+
<id>ossrh</id>
8+
<username>${env.OSSRH_JIRA_USERNAME}</username>
9+
<password>${env.OSSRH_JIRA_PASSWORD}</password>
10+
</server>
11+
</servers>
12+
<profiles>
13+
<profile>
14+
<id>ossrh</id>
15+
<activation>
16+
<activeByDefault>true</activeByDefault>
17+
</activation>
18+
<properties>
19+
<gpg.executable>gpg</gpg.executable>
20+
<gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
21+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
22+
</properties>
23+
</profile>
24+
</profiles>
25+
</settings>
26+

0 commit comments

Comments
 (0)