Skip to content

Commit 7fbe6f1

Browse files
wiktorolkoBenFradet
authored andcommitted
Add ability to publish to bintray and central (closes #3)
1 parent 124c85d commit 7fbe6f1

File tree

7 files changed

+107
-3
lines changed

7 files changed

+107
-3
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ jdk:
66

77
script:
88
- ./gradlew build
9+
10+
deploy:
11+
skip_cleanup: true
12+
provider: script
13+
script: ./.travis/deploy.sh $TRAVIS_TAG
14+
on:
15+
tags: true

.travis/deploy.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
tag_version=$1
4+
5+
cd $TRAVIS_BUILD_DIR
6+
pwd
7+
8+
project_version=`cat VERSION`
9+
if [ "${project_version}" == "${tag_version}" ]; then
10+
./gradlew bintrayUpload
11+
else
12+
echo "Tag version '${tag_version}' doesn't match version in project ('${project_version}'). Aborting!"
13+
exit 1
14+
fi

build.gradle

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
plugins {
22
id 'java'
3+
id 'maven-publish'
4+
id 'com.jfrog.bintray' version '1.8.4'
35
}
46

57
group = 'com.snowplowanalytics'
8+
archivesBaseName = 'java-referer-parser'
69
version = '0.4.0'
10+
711
sourceCompatibility = '1.8'
812
targetCompatibility = '1.8'
913

@@ -16,4 +20,82 @@ dependencies {
1620
compile 'org.apache.httpcomponents:httpclient:4.5.3'
1721
testCompile 'junit:junit:4.12'
1822
testCompile 'org.json:json:20180813'
23+
}
24+
25+
bintray {
26+
user = System.getenv('BINTRAY_USER')
27+
key = System.getenv('BINTRAY_API_KEY')
28+
29+
pkg {
30+
repo = 'snowplow-maven'
31+
name = archivesBaseName
32+
licenses = ['Apache-2.0']
33+
vcsUrl = 'https://github.com/snowplow-referer-parser/java-referer-parser.git'
34+
}
35+
publications = ['mavenJava']
36+
version {
37+
name = version
38+
gpg {
39+
sign = true
40+
}
41+
mavenCentralSync {
42+
sync = true
43+
user = System.getenv('SONA_USER')
44+
password = System.getenv('SONA_PASS')
45+
}
46+
}
47+
}
48+
49+
task javadocJar(type: Jar) {
50+
classifier = 'javadoc'
51+
from javadoc
52+
}
53+
54+
task sourcesJar(type: Jar) {
55+
classifier = 'sources'
56+
from sourceSets.main.allSource
57+
}
58+
59+
def pomConfig = {
60+
licenses {
61+
license {
62+
name "The Apache Software License, Version 2.0"
63+
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
64+
distribution "repo"
65+
}
66+
}
67+
developers {
68+
developer {
69+
id 'alexanderdean'
70+
name 'Alexander Dean'
71+
72+
}
73+
}
74+
75+
scm {
76+
connection 'https://github.com/snowplow-referer-parser/java-referer-parser.git'
77+
developerConnection 'https://github.com/snowplow-referer-parser/java-referer-parser.git'
78+
url 'https://github.com/snowplow-referer-parser/java-referer-parser'
79+
}
80+
}
81+
82+
// Create the publication with the pom configuration:
83+
publishing {
84+
publications {
85+
mavenJava(MavenPublication) {
86+
from components.java
87+
artifact sourcesJar
88+
artifact javadocJar
89+
groupId group
90+
artifactId 'java-referer-parser'
91+
version version
92+
pom.withXml {
93+
def root = asNode()
94+
root.appendNode('description', 'This is the Java implementation of referer-parser, the library for extracting attribution data from referer (sic) URLs.')
95+
root.appendNode('name', 'Java Referer Parser')
96+
root.appendNode('url', 'https://github.com/snowplow-referer-parser/java-referer-parser')
97+
root.children().last() + pomConfig
98+
}
99+
}
100+
}
19101
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enableFeaturePreview('STABLE_PUBLISHING')

src/main/java/com/snowplowanalytics/refererparser/Medium.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* that we can detect - "medium"
2222
* in Google's language.
2323
*
24-
* @author Alex Dean (@alexatkeplar) <support at snowplowanalytics com>
24+
* @author Alex Dean (@alexatkeplar)
2525
*/
2626
public enum Medium {
2727
UNKNOWN,

src/main/java/com/snowplowanalytics/refererparser/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
/**
3838
* Java implementation of <a href="https://github.com/snowplow/referer-parser">Referer Parser</a>
3939
*
40-
* @author Alex Dean (@alexatkeplar) <support at snowplowanalytics com>
40+
* @author Alex Dean (@alexatkeplar)
4141
*/
4242
public class Parser {
4343

src/main/java/com/snowplowanalytics/refererparser/Referer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Referer data class
2323
*
24-
* @author Alex Dean (@alexatkeplar) <support at snowplowanalytics com>
24+
* @author Alex Dean (@alexatkeplar)
2525
*/
2626
public class Referer {
2727
public final Medium medium;

0 commit comments

Comments
 (0)