diff --git a/.travis.yml b/.travis.yml index 1776473..812bdcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,10 @@ jdk: script: - ./gradlew build + +deploy: + skip_cleanup: true + provider: script + script: ./.travis/deploy.sh $TRAVIS_TAG + on: + tags: true diff --git a/.travis/deploy.sh b/.travis/deploy.sh new file mode 100755 index 0000000..036d5dc --- /dev/null +++ b/.travis/deploy.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +tag_version=$1 + +cd $TRAVIS_BUILD_DIR +pwd + +project_version=`cat VERSION` +if [ "${project_version}" == "${tag_version}" ]; then + ./gradlew bintrayUpload +else + echo "Tag version '${tag_version}' doesn't match version in project ('${project_version}'). Aborting!" + exit 1 +fi diff --git a/build.gradle b/build.gradle index 098d53b..e902bdf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,13 @@ plugins { id 'java' + id 'maven-publish' + id 'com.jfrog.bintray' version '1.8.4' } group = 'com.snowplowanalytics' +archivesBaseName = 'java-referer-parser' version = '0.4.0' + sourceCompatibility = '1.8' targetCompatibility = '1.8' @@ -16,4 +20,82 @@ dependencies { compile 'org.apache.httpcomponents:httpclient:4.5.3' testCompile 'junit:junit:4.12' testCompile 'org.json:json:20180813' +} + +bintray { + user = System.getenv('BINTRAY_USER') + key = System.getenv('BINTRAY_API_KEY') + + pkg { + repo = 'snowplow-maven' + name = archivesBaseName + licenses = ['Apache-2.0'] + vcsUrl = 'https://github.com/snowplow-referer-parser/java-referer-parser.git' + } + publications = ['mavenJava'] + version { + name = version + gpg { + sign = true + } + mavenCentralSync { + sync = true + user = System.getenv('SONA_USER') + password = System.getenv('SONA_PASS') + } + } +} + +task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource +} + +def pomConfig = { + licenses { + license { + name "The Apache Software License, Version 2.0" + url "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution "repo" + } + } + developers { + developer { + id 'alexanderdean' + name 'Alexander Dean' + email 'alex@snowplowanalytics.com' + } + } + + scm { + connection 'https://github.com/snowplow-referer-parser/java-referer-parser.git' + developerConnection 'https://github.com/snowplow-referer-parser/java-referer-parser.git' + url 'https://github.com/snowplow-referer-parser/java-referer-parser' + } +} + +// Create the publication with the pom configuration: +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + groupId group + artifactId 'java-referer-parser' + version version + pom.withXml { + def root = asNode() + root.appendNode('description', 'This is the Java implementation of referer-parser, the library for extracting attribution data from referer (sic) URLs.') + root.appendNode('name', 'Java Referer Parser') + root.appendNode('url', 'https://github.com/snowplow-referer-parser/java-referer-parser') + root.children().last() + pomConfig + } + } + } } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..3749d0e --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +enableFeaturePreview('STABLE_PUBLISHING') diff --git a/src/main/java/com/snowplowanalytics/refererparser/Medium.java b/src/main/java/com/snowplowanalytics/refererparser/Medium.java index 17db3d7..7a4c799 100644 --- a/src/main/java/com/snowplowanalytics/refererparser/Medium.java +++ b/src/main/java/com/snowplowanalytics/refererparser/Medium.java @@ -21,7 +21,7 @@ * that we can detect - "medium" * in Google's language. * - * @author Alex Dean (@alexatkeplar) + * @author Alex Dean (@alexatkeplar) */ public enum Medium { UNKNOWN, diff --git a/src/main/java/com/snowplowanalytics/refererparser/Parser.java b/src/main/java/com/snowplowanalytics/refererparser/Parser.java index ee50cc5..4d9c232 100644 --- a/src/main/java/com/snowplowanalytics/refererparser/Parser.java +++ b/src/main/java/com/snowplowanalytics/refererparser/Parser.java @@ -37,7 +37,7 @@ /** * Java implementation of Referer Parser * - * @author Alex Dean (@alexatkeplar) + * @author Alex Dean (@alexatkeplar) */ public class Parser { diff --git a/src/main/java/com/snowplowanalytics/refererparser/Referer.java b/src/main/java/com/snowplowanalytics/refererparser/Referer.java index a8df9b6..b191516 100644 --- a/src/main/java/com/snowplowanalytics/refererparser/Referer.java +++ b/src/main/java/com/snowplowanalytics/refererparser/Referer.java @@ -21,7 +21,7 @@ /** * Referer data class * - * @author Alex Dean (@alexatkeplar) + * @author Alex Dean (@alexatkeplar) */ public class Referer { public final Medium medium;