Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ jdk:

script:
- ./gradlew build

deploy:
skip_cleanup: true
provider: script
script: ./.travis/deploy.sh $TRAVIS_TAG
on:
tags: true
14 changes: 14 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -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
82 changes: 82 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have a key so this will most likely fail

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's obligatory to have signing enabled.

https://github.com/bintray/gradle-bintray-plugin#Maven_Central_Sync

(...) also files must be signed to be sent to Maven Central, so GPG file signing should be enabled (see above) if Maven Central sync is enabled

Here is an article how to create a signature:
https://medium.com/@nmauti/publishing-a-project-on-maven-central-8106393db2c3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah indeed, didn't know bintray did it for us: https://github.com/bintray/gradle-bintray-plugin#gpg-file-signing

}
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 '[email protected]'
}
}

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
}
}
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enableFeaturePreview('STABLE_PUBLISHING')
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* that we can detect - "medium"
* in Google's language.
*
* @author Alex Dean (@alexatkeplar) <support at snowplowanalytics com>
* @author Alex Dean (@alexatkeplar)
*/
public enum Medium {
UNKNOWN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/**
* Java implementation of <a href="https://github.com/snowplow/referer-parser">Referer Parser</a>
*
* @author Alex Dean (@alexatkeplar) <support at snowplowanalytics com>
* @author Alex Dean (@alexatkeplar)
*/
public class Parser {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Referer data class
*
* @author Alex Dean (@alexatkeplar) <support at snowplowanalytics com>
* @author Alex Dean (@alexatkeplar)
*/
public class Referer {
public final Medium medium;
Expand Down