Skip to content

Commit a11150a

Browse files
committed
Merge pull request #70 from contentful/iss68
Auto-deploy snapshots to Sonatype
2 parents 1f92140 + 33b77ef commit a11150a

File tree

6 files changed

+81
-39
lines changed

6 files changed

+81
-39
lines changed

.buildscript/deploy_snapshot.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#
3+
# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
4+
#
5+
# Adapted from https://coderwall.com/p/9b_lfq and
6+
# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
7+
8+
SLUG="contentful/contentful.java"
9+
JDK="oraclejdk8"
10+
BRANCH="master"
11+
12+
set -e
13+
14+
if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
15+
echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
16+
elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
17+
echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
18+
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
19+
echo "Skipping snapshot deployment: was pull request."
20+
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
21+
echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
22+
else
23+
echo "Deploying snapshot..."
24+
mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true
25+
echo "Snapshot deployed!"
26+
fi

.buildscript/settings.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<settings>
2+
<servers>
3+
<server>
4+
<id>sonatype-nexus-snapshots</id>
5+
<username>${env.CI_DEPLOY_USERNAME}</username>
6+
<password>${env.CI_DEPLOY_PASSWORD}</password>
7+
</server>
8+
</servers>
9+
</settings>

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
.idea/
33
*.iml
44
target/
5-
settings.xml

.travis.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
language: java
2-
install: mvn install -DskipTests=true -Dgpg.skip=true
3-
sudo: false
42

53
jdk:
64
- oraclejdk7
75
- oraclejdk8
86

7+
after_success:
8+
- .buildscript/deploy_snapshot.sh
9+
- mvn clean cobertura:cobertura coveralls:report
10+
11+
env:
12+
global:
13+
- secure: ZkYu76rxDUUgoUSIz12CReNZHd2c5O2LBWCHnuQpqfJfcCXBr1J24F7WftiFXH+9Od43qHdF4hQ9Vy0vWEHSJ1hxZnCIy5yYsvqV4GJ94DIJhvNqmo48QPkA3tFUsqd48rEeBXMUsON30m89KDp1se2+l3UJaX+R27RUi47nraU=
14+
- secure: jKXD1hYVgJypaQHRSm4gshxMhB+T+UibaLDLCSfGWSaGzogDsWnPXf9qqG3jtozKHyH0BkANaaO6rRgNQNfbaklm4jopL1bdRkd47JO/nibNwuVcG07TQyCPQR6jv/WoRAkxXOGdMSwwS2+puM7FJqLarbzY7uBEJtNsZn5JT48=
15+
16+
sudo: false
17+
918
branches:
1019
except:
1120
- gh-pages
12-
13-
after_success:
14-
- mvn clean cobertura:cobertura coveralls:report

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ or Gradle:
2323
compile 'com.contentful.java:java-sdk:2.0.2'
2424
```
2525

26+
Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
27+
2628
The SDK requires at minimum Java 6 or Android 2.3.
2729

2830
### Default Client
@@ -212,3 +214,4 @@ Copyright (c) 2015 Contentful GmbH. See [LICENSE.txt][6] for further details.
212214
[6]: LICENSE.txt
213215
[7]: https://github.com/contentful/contentful.java/wiki/2.0-Migration
214216
[8]: pom.xml
217+
[snap]: https://oss.sonatype.org/content/repositories/snapshots/

pom.xml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -248,40 +248,39 @@
248248
</execution>
249249
</executions>
250250
</plugin>
251-
252-
<plugin>
253-
<groupId>org.apache.maven.plugins</groupId>
254-
<artifactId>maven-gpg-plugin</artifactId>
255-
<version>1.5</version>
256-
257-
<configuration>
258-
<useAgent>true</useAgent>
259-
</configuration>
260-
261-
<executions>
262-
<execution>
263-
<id>sign-artifacts</id>
264-
<phase>verify</phase>
265-
<goals>
266-
<goal>sign</goal>
267-
</goals>
268-
</execution>
269-
</executions>
270-
</plugin>
271251
</plugins>
272252
</build>
273253

274-
<repositories>
275-
<repository>
276-
<id>sonatype.oss.snapshots</id>
277-
<name>Sonatype OSS Snapshot Repository</name>
278-
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
279-
<releases>
280-
<enabled>false</enabled>
281-
</releases>
282-
<snapshots>
283-
<enabled>true</enabled>
284-
</snapshots>
285-
</repository>
286-
</repositories>
254+
<profiles>
255+
<profile>
256+
<id>release</id>
257+
<activation>
258+
<activeByDefault>false</activeByDefault>
259+
</activation>
260+
261+
<build>
262+
<plugins>
263+
<plugin>
264+
<groupId>org.apache.maven.plugins</groupId>
265+
<artifactId>maven-gpg-plugin</artifactId>
266+
<version>1.5</version>
267+
268+
<configuration>
269+
<useAgent>true</useAgent>
270+
</configuration>
271+
272+
<executions>
273+
<execution>
274+
<id>sign-artifacts</id>
275+
<phase>verify</phase>
276+
<goals>
277+
<goal>sign</goal>
278+
</goals>
279+
</execution>
280+
</executions>
281+
</plugin>
282+
</plugins>
283+
</build>
284+
</profile>
285+
</profiles>
287286
</project>

0 commit comments

Comments
 (0)