Skip to content

Commit

Permalink
Adds support for continuous integration on travis by ensuring that ev…
Browse files Browse the repository at this point in the history
…ery untagged commit to master is

deployed to the sonatype snapshot repository.

Resolves the sonatype snapshot deployment part of  https://jira.lyrasis.org/browse/FCREPO-3291
  • Loading branch information
dbernstein committed May 4, 2020
1 parent 95e9c77 commit cb0535b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ before_install:
- "echo $PATH"
- "export JAVA_OPTS=-Xmx512m"
- "mvn -N io.takari:maven:0.7.7:wrapper -Dmaven=${MAVEN_VERSION}"
- if [ ! -z "$GPG_SECRET_KEYS" ]; then echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import; fi
- if [ ! -z "$GPG_OWNERTRUST" ]; then echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust; fi

deploy:
-
provider: script
script: .travis/deploy.sh
skip_cleanup: true
on:
repo: fcrepo4/fcrepo4
branch: master

# Default installation command is
# mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
Expand All @@ -46,7 +57,7 @@ before_script:
fi

script:
- ./mvnw -Dfcrepo.streaming.parallel=true install -B -V
- ./mvnw --settings .travis/settings.xml -Dgpg.skip -Dfcrepo.streaming.parallel=true install -B -V

notifications:
irc: "irc.freenode.org#fcrepo"
Expand Down
8 changes: 8 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if [ ! -z "$TRAVIS_TAG" ]
then
echo "on a tag -> $TRAVIS_TAG and therefore we will do nothing. Tagged releases are deployed to sonatype manually."
else
echo "not on a tag -> deploying to sonatype snapshot repo..."
./mvnw clean deploy --settings .travis/settings.xml -DskipTests=true -B -U
fi

25 changes: 25 additions & 0 deletions .travis/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
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">
<servers>
<server>
<!-- Maven Central Deployment -->
<id>ossrh</id>
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
54 changes: 54 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@
<!-- default properties that can be altered on the command line -->
<fcrepo.test.context.path />
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<modules>
<module>fcrepo-kernel-api</module>
<module>fcrepo-kernel-impl</module>
Expand All @@ -94,6 +106,7 @@
<module>fcrepo-persistence-common</module>
<module>fcrepo-persistence-ocfl</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -669,11 +682,27 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
Expand Down Expand Up @@ -745,6 +774,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit cb0535b

Please sign in to comment.