Skip to content

Commit e545d78

Browse files
authored
Only publish to GitHub if not a snapshot
1 parent 439902a commit e545d78

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ version '1.1.2'
1111
sourceCompatibility = 1.8
1212
targetCompatibility = 1.8
1313

14+
def snapshotVersion = version.endsWith('-SNAPSHOT') || version.endsWith('.SNAPSHOT')
15+
1416
configurations {
1517
compileOnly {
1618
extendsFrom annotationProcessor
@@ -147,7 +149,7 @@ publishing {
147149
repositories {
148150
maven {
149151
name = 'sonatype'
150-
if (version.endsWith('-SNAPSHOT') || version.endsWith('.SNAPSHOT')) {
152+
if (snapshotVersion) {
151153
url = 'https://oss.sonatype.org/content/repositories/snapshots'
152154
} else {
153155
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
@@ -171,3 +173,7 @@ publishing {
171173
signing {
172174
sign publishing.publications.maven
173175
}
176+
177+
tasks.publishMavenPublicationToGithubRepository.configure {
178+
onlyIf { !snapshotVersion }
179+
}

0 commit comments

Comments
 (0)