Skip to content

Commit

Permalink
Automate release process
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi committed Mar 17, 2019
1 parent 2788968 commit 201dc79
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 75 deletions.
41 changes: 27 additions & 14 deletions .travis.yml
@@ -1,3 +1,4 @@
dist: xenial
language: java
jdk:
- openjdk8
Expand All @@ -7,31 +8,43 @@ before_install:
- ulimit -c unlimited -S
script:
- ./mvnw verify -B
- ./mvnw site -pl docs -B
- ./mvnw site -pl docs -B -q
after_success:
- bash .travis_after_success.sh
- bash ci/after_success.sh
cache:
directories:
- $HOME/.m2
deploy:
provider: script
script: bash .travis_deploy.sh
on:
repo: dropwizard/dropwizard
branch: master
jdk: openjdk8
- provider: script
script: bash ci/deploy-snapshot.sh
on:
repo: dropwizard/dropwizard
tags: false
branch: master
jdk: openjdk8
- provider: script
script: bash ci/deploy-release.sh
on:
repo: dropwizard/dropwizard
tags: true
jdk: openjdk8
- provider: pages
github-token: $GITHUB_TOKEN
skip-cleanup: true
keep-history: true
local-dir: ./gh-pages
on:
tags: true
# encrypted CI_DEPLOY_USERNAME and CI_DEPLOY_PASSWORD
# values for maven deploy. these have been encrypted
# with the public key from https://github.com/dropwizard/dropwizard
# and won't work in any other repository. if you want
# to run CI in your local fork you'll need to run `travis encrypt ...`
# accordingly (http://docs.travis-ci.com/user/encryption-keys/)
#
# NOTE: CI_DEPLOY_USERNAME is set to dropwizardci, the username
# we've set up with Sonatype, which only has permission to push
# to the snapshot repo.
env:
global:
- secure: "EAuz7bCKj4r438IEC2y73WVrFwXirflbXA4HhpwVmAFWNqC9LIIpkWcO5GVp773HsZvJBcJjJriP+aKRkImV8AyMgjCeEUv2dlezvbkIIz38vKyw9MWaPIyZ3uS9RCuL7OwGf5BeJ1DvHFYdMBaspZd+EmCYr7abnHdqs+Tm/W8="
- secure: "RI0QcuKMsij3sgRm+Bjhu3X217U6UslvSzcRv13iLLwrTj73zhGi5PF/+kj8Qh1HMQw0oQRR6M8qPqGy82KcjiGbpgPgSy1rVAvkYg+Yw1k7v4l7Vgyj7TNsAM3pqHyojx2jgRjpQsgw/WXQmiahWV6OCOUzdbhEUwVzIXI+vtk="
- JAVA_OPTS: "'-Xms512m -Xmx2g'"
- secure: "MPnKTiK+9rmqu4R1f2Wozj/DuC8M74THepmvXZKCB6ysCkXPjf7FuWxd29uVdk3Mwb4X90KdzyafOY/GVkVze+/AEorFjIF8FFqBpgGmOG5D9PMKZbF7DNisOShPsITz6+RmYzRTT5xLeRGntAAy6aDWtWTh06CSCypEMT5lD10="
- secure: "WY1zEZD8nwGQXaYDrItkBWmYHhbQ3Ekseq82cTIJedG7zb8KbwpVDUo+6yRf1EPmpnDbRE9N0wgtzQq8B3+X87ZnO6RrEuv6ulkLJJlrwcRmRjfDY9rwRTUUbFZYrHP0fiLedPE6xpokPiO7Y+tRpofVfv2YnxW69GWwQG224KY="
- secure: "W4rGYMaNKW2K1oSJFEr1Q+InQxvW4cdXk6Z1wE+U3CeZd8YeZ8RaaRUVObTMeeUvIzYlbU/stb9dghQMyYKjgaOZE3zWzDV9NP1e83sX7LyCd3q9wufEzI2dwenfXDnVHehG110wXWjUQSAwYyUTXn5bzMvyHSCqwN4X5mGSFzw="
- secure: "Oi1Ni7GZUEY0AqFDkWqKrsX7p1OVoPgYVcM//edlst0QUE1rRVzrQAaucJYATis+K9l+/00fIC4OlqXv2pk+wufMCKi+rFeDqHBvYMz8vwYE2MBbcuT8FEoeIJUA9SeOj/RtNQZw7ynOqhfu1f0x8XMPazA7W2/i8CEMuoa/+Rk="
8 changes: 0 additions & 8 deletions .travis_after_success.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .travis_deploy.sh

This file was deleted.

1 change: 1 addition & 0 deletions ci/.gitignore
@@ -0,0 +1 @@
dropwizard.asc
8 changes: 8 additions & 0 deletions ci/after_success.sh
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
set -uxo pipefail

if [[ "${TRAVIS_JDK_VERSION}" == "openjdk8" ]]; then
./mvnw test jacoco:report coveralls:report -P code-coverage -B -q
exit $?
fi
16 changes: 16 additions & 0 deletions ci/deploy-release.sh
@@ -0,0 +1,16 @@
#!/bin/bash
set -e
set -uxo pipefail

# Decrypt and import signing key
openssl aes-256-cbc -K $encrypted_ec79e61fc360_key -iv $encrypted_ec79e61fc360_iv -in ci/dropwizard.asc.enc -out ci/dropwizard.asc -d
gpg --fast-import ci/dropwizard.asc

./mvnw -B deploy --settings 'ci/settings.xml' -DperformRelease=true -Dmaven.test.skip=true

# Documentation
./mvnw -B site site:stage --settings 'ci/settings.xml' -Dmaven.test.skip=true

DOCS_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
mkdir gh-pages
mv target/staging gh-pages/"${DOCS_VERSION}"
5 changes: 5 additions & 0 deletions ci/deploy-snapshot.sh
@@ -0,0 +1,5 @@
#!/bin/bash
set -e
set -uxo pipefail

./mvnw -B deploy --settings 'ci/settings.xml' -Dmaven.test.skip=true
Binary file added ci/dropwizard.asc.enc
Binary file not shown.
17 changes: 6 additions & 11 deletions maven_deploy_settings.xml → ci/settings.xml
Expand Up @@ -2,20 +2,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<id>ossrh</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>gpg.passphrase</id>
<password>${env.GPG_PASSWORD}</password>
</server>
</servers>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
</settings>
110 changes: 70 additions & 40 deletions pom.xml
Expand Up @@ -222,7 +222,7 @@

<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<id>ossrh</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
Expand All @@ -236,12 +236,12 @@

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<id>ossrh</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<id>ossrh</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
Expand All @@ -254,7 +254,7 @@

<profiles>
<profile>
<id>release-sign-artifacts</id>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
Expand All @@ -263,13 +263,41 @@
</activation>
<properties>
<maven.compiler.optimize>true</maven.compiler.optimize>
<gpg.keyname>7D4868B53E31E7AD</gpg.keyname>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclint>none</doclint>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -280,6 +308,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
<executions>
<execution>
<id>nexus-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -288,7 +334,9 @@
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.source.skip>true</maven.source.skip>
<dependency-check.skip>true</dependency-check.skip>
<pgpverify.skip>true</pgpverify.skip>
<jacoco.skip>true</jacoco.skip>
</properties>
<build>
<plugins>
Expand All @@ -302,13 +350,6 @@
<perCoreThreadCount>true</perCoreThreadCount>
</configuration>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -563,6 +604,11 @@
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>sphinx-maven-plugin</artifactId>
Expand All @@ -573,6 +619,17 @@
<artifactId>pgpverify-maven-plugin</artifactId>
<version>1.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -606,41 +663,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclint>none</doclint>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<mavenExecutorId>forked-path</mavenExecutorId>
<tagNameFormat>v@{project.version}</tagNameFormat>
<useReleaseProfile>false</useReleaseProfile>
<preparationGoals>clean test</preparationGoals>
</configuration>
</plugin>
Expand Down

0 comments on commit 201dc79

Please sign in to comment.