Skip to content

Commit

Permalink
- added automated SNAPSHOT publishing to Maven Central repository
Browse files Browse the repository at this point in the history
  • Loading branch information
rhajek committed Oct 4, 2018
1 parent 74c3feb commit ce65a41
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<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>

18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,29 @@ services:
# We test against all influxdb versions with the most actual JDK.
# Test only the most recent influxdb version with JDK8 which will be legacy soon.
env:
global:
- secure: aCFuNNixYILZZfcOp0jI66om4w8Cbr+qtz1FUOVgbxeipFA93y7KLoXtFajkE1qmbHOdz8SvPcloY5q6HKIOYuqv4/6at+OaTogXELfrR+oKfxf2t5PfB1D+1RxM90+wjsEPGQh+HmFOEnGCnJ8ZUfcx76Afs+mPzbpjzKeNz7w=
- secure: dAJK41xM2dN3q3xJMqAOP6uvrOvpjjUzmHr8mYNyepER8Lpms9/GqVUxqJv12wzCBqv1XZk/CXxrv3iBc2XjlxlrzIJGQChTinwDEigv0BMl/Gh0821ja7gwzMEUmg9f79m5tJxIFQ306cWz1gyRDqM3fLzskvM2ayzvynsNc/w=

matrix:
- MAVEN_JAVA_VERSION=3-jdk-10-slim INFLUXDB_VERSION=1.6
- MAVEN_JAVA_VERSION=3-jdk-10-slim INFLUXDB_VERSION=1.5
- MAVEN_JAVA_VERSION=3-jdk-10-slim INFLUXDB_VERSION=1.4
- MAVEN_JAVA_VERSION=3-jdk-10-slim INFLUXDB_VERSION=1.3
- MAVEN_JAVA_VERSION=3-jdk-10-slim INFLUXDB_VERSION=1.2
- MAVEN_JAVA_VERSION=3-jdk-10-slim INFLUXDB_VERSION=1.1
- MAVEN_JAVA_VERSION=3-jdk-8-slim INFLUXDB_VERSION=1.6
- MAVEN_JAVA_VERSION=3-jdk-8-slim INFLUXDB_VERSION=1.6 SNAPSHOT=Y

script: "./compile-and-test.sh"

script: ./compile-and-test.sh
deploy:
provider: script
script: "./deploy-snapshot.sh"
skip_cleanup: true
on:
repo: influxdata/influxdb-java
condition: $SNAPSHOT == "Y" && $DEPLOY_SNAPSHOT == "Y"
branch: master

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
26 changes: 26 additions & 0 deletions deploy-snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -e

#Parse project version from pom.xml
export PROJECT_VERSION=`xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" pom.xml`
echo "Project version: $PROJECT_VERSION"

#Skip if not *SNAPSHOT
if [[ $PROJECT_VERSION != *SNAPSHOT ]]; then
echo "$PROJECT_VERSION is not SNAPSHOT - skip deploy.";
exit;
fi


DEFAULT_MAVEN_JAVA_VERSION="3-jdk-8-slim"
MAVEN_JAVA_VERSION="${MAVEN_JAVA_VERSION:-$DEFAULT_MAVEN_JAVA_VERSION}"
echo "Deploy snapshot with maven:${MAVEN_JAVA_VERSION}"

docker run -it --rm \
--volume ${PWD}:/usr/src/mymaven \
--volume ${PWD}/.m2:/root/.m2 \
--workdir /usr/src/mymaven \
--env SONATYPE_USERNAME=${SONATYPE_USERNAME} \
--env SONATYPE_PASSWORD=${SONATYPE_PASSWORD} \
maven:${MAVEN_JAVA_VERSION} mvn -s .maven-settings.xml -DskipTests=true clean package deploy

0 comments on commit ce65a41

Please sign in to comment.