Skip to content

Commit 2e670e5

Browse files
committed
Added functionality for releasing to bintray
1 parent ab159e5 commit 2e670e5

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ cache:
1313

1414
stages:
1515
- name: build
16+
- name: release
1617

1718
jobs:
1819
include:
1920
- stage: build
20-
script: /bin/sh ./gradlew build
21+
script: /bin/sh ./gradlew build
22+
- stage: release
23+
script: /bin/sh ./gradlew bintrayUpload -x test -Dbintray.user=$BINTRAY_USER -Dbintray.key=$BINTRAY_KEY -Dbuild.number=$TRAVIS_BUILD_NUMBER

build.gradle

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
11
plugins {
22
id "io.freefair.lombok" version "4.1.2"
3+
id "com.jfrog.bintray" version "1.8.4"
4+
id 'com.intershop.gradle.scmversion' version '6.0.0'
35
}
46

57
group 'com.fortify.ssc.parser.owasp.dependencycheck'
68

79
apply plugin: 'java'
8-
apply plugin: 'idea'
10+
sourceCompatibility = 1.8
11+
12+
scm {
13+
version {
14+
type = 'threeDigits'
15+
initialVersion = '1.0.0'
16+
increment = 'MINOR'
17+
continuousRelease = true
18+
}
19+
}
920

1021
ext {
1122
versionRegex = '(\\d+)(\\.\\d+)*'
1223
jacksonVersion = "2.8.4"
1324
}
1425

15-
// plugin version, note the version must match versionRegex.
16-
version = '1.0'
26+
def getDate() {
27+
new Date().format('yyyyMMddHHmmssSSS')
28+
}
29+
30+
// Project version based on SCM information
31+
// Reg-ex to generate format <major>.<minor>[.<date>]
32+
// With date part only added for snapshot versions
33+
version = scm.version.version \
34+
.replaceFirst(/^(\d+\.)(\d+).+?(-SNAPSHOT)?$/, '$1$2$3') \
35+
.replaceFirst(/-SNAPSHOT/, ".00${getDate()}")
1736

1837
if (!project.hasProperty('release')) {
1938
// Gradle has been run without option -Prelease - auto increment plugin version
@@ -65,9 +84,9 @@ dependencies {
6584
jar {
6685
doFirst {
6786
// check if version matches requirements
68-
if (!version.matches(versionRegex)) {
69-
throw new InvalidUserDataException("Plugin version '$version' does not match '$versionRegex'")
70-
}
87+
//if (!version.matches(versionRegex)) {
88+
// throw new InvalidUserDataException("Plugin version '$version' does not match '$versionRegex'")
89+
//}
7190
}
7291
// replace version placeholders in plugin.xml
7392
filesMatching('plugin.xml') {
@@ -79,3 +98,25 @@ jar {
7998
from { configurations.compileExport.collect { it.isDirectory() ? it : zipTree(it).matching { exclude 'META-INF/*' } } }
8099
}
81100

101+
bintray {
102+
user = System.getenv('BINTRAY_USER')
103+
key = System.getenv('BINTRAY_KEY')
104+
publish = true
105+
pkg {
106+
repo = 'binaries'
107+
name = 'fortify-ssc-parser-owasp-dependency-check'
108+
licenses = ['MIT']
109+
vcsUrl = 'https://github.com/fortify-ps/fortify-ssc-parser-owasp-dependency-check.git'
110+
userOrg = 'fortify-ps'
111+
version {
112+
name = project.version
113+
}
114+
}
115+
filesSpec {
116+
from("build/libs") {
117+
include "*.jar"
118+
}
119+
into '.'
120+
}
121+
}
122+

0 commit comments

Comments
 (0)