Add SNAPSHOT archives upload
This commit is contained in:
11
.travis.yml
11
.travis.yml
@@ -9,8 +9,15 @@ before_install:
|
||||
- "cp -r stub-runner/stub-runner-spring/src/test/resources/m2repo/repository/io/codearte/accurest/stubs $HOME/.m2/repository/io/codearte/accurest/"
|
||||
|
||||
jdk:
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
|
||||
install: ./gradlew assemble -s
|
||||
script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh
|
||||
script: ./gradlew check funcTest install -s --continue && jdk_switcher use oraclejdk8 && ./scripts/runTests.sh && jdk_switcher use $TRAVIS_JDK_VERSION && ./gradlew uploadSnapshotArchives -s
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Automatic snapshot release only in Java 7 build
|
||||
- jdk: oraclejdk7
|
||||
env:
|
||||
- DO_RELEASE=true
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ nexusStaging {
|
||||
stagingProfileId = '93c08fdebde1ff'
|
||||
}
|
||||
|
||||
apply from: "$rootDir/gradle/releaseRoot.gradle"
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'groovy'
|
||||
apply from: "$rootDir/gradle/release.gradle"
|
||||
@@ -211,4 +213,5 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "com.palantir.idea-test-fix"
|
||||
apply plugin: "com.palantir.idea-test-fix"
|
||||
|
||||
|
||||
@@ -38,3 +38,22 @@ modifyPom {
|
||||
|
||||
uploadArchives.dependsOn { check }
|
||||
|
||||
|
||||
task uploadSnapshotArchives {
|
||||
if (shouldUploadSnapshotArchives) {
|
||||
dependsOn { uploadArchives }
|
||||
}
|
||||
onlyIf { shouldUploadSnapshotArchives }
|
||||
}
|
||||
|
||||
//for Travis to leverage secure variables
|
||||
project.ext {
|
||||
if (!hasProperty('nexusUsername') && System.env.NEXUS_USERNAME) {
|
||||
nexusUsername = System.env.NEXUS_USERNAME
|
||||
}
|
||||
if (!hasProperty('nexusPassword') && System.env.NEXUS_PASSWORD) {
|
||||
nexusPassword = System.env.NEXUS_PASSWORD
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
16
gradle/releaseRoot.gradle
Normal file
16
gradle/releaseRoot.gradle
Normal file
@@ -0,0 +1,16 @@
|
||||
assert project == rootProject
|
||||
|
||||
project.ext {
|
||||
isSnapshot = project.version.endsWith("-SNAPSHOT")
|
||||
currentBranch = System.env.TRAVIS_BRANCH
|
||||
isPr = !isNullOrFalse(System.env.TRAVIS_PULL_REQUEST)
|
||||
doRelease = !isNullOrFalse(System.env.DO_RELEASE)
|
||||
shouldUploadSnapshotArchives = isSnapshot && currentBranch == 'master' && !isPr && doRelease
|
||||
}
|
||||
|
||||
logger.lifecycle("Automatic snapshot release: {} (isSnapshot: {}, currentBranch: {}, isPr: {}, doRelease: {})", shouldUploadSnapshotArchives, isSnapshot, currentBranch, isPr, doRelease)
|
||||
|
||||
private boolean isNullOrFalse(def env) {
|
||||
env == null || env == "false" || (env instanceof Boolean && !env)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user