@@ -5,6 +5,7 @@ plugins {
5
5
id ' net.researchgate.release' version ' 3.0.0'
6
6
id ' io.codearte.nexus-staging' version ' 0.30.0'
7
7
id ' com.gradle.plugin-publish' version ' 0.21.0'
8
+ id ' org.jreleaser' version ' 1.15.0'
8
9
}
9
10
10
11
apply from : ' gradle/integration-test.gradle'
@@ -86,110 +87,99 @@ test {
86
87
}
87
88
88
89
publishing {
89
- afterEvaluate {
90
- def pluginUrl = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin'
91
-
92
- pluginBundle {
93
- website = pluginUrl
94
- vcsUrl = pluginUrl
95
- description = pluginDescription
96
- tags = [' sonatype' , ' scan' , ' dependencies' , ' ossindex' , ' iq server' ]
97
- System . setProperty(' gradle.publish.key' , System . getenv(' GRADLE_PUBLISH_KEY' ) ?: ' ' )
98
- System . setProperty(' gradle.publish.secret' , System . getenv(' GRADLE_PUBLISH_SECRET' ) ?: ' ' )
99
- }
100
-
101
- release {
102
- // avoid infinite CircleCI builds triggered by release commits
103
- preCommitText = ' [skip ci] '
104
- buildTasks = [' assemble' ]
105
- }
106
-
107
- def sonatypeUsername = System . getenv(' SONATYPE_USERNAME' )
108
- def sonatypePassword = System . getenv(' SONATYPE_PASSWORD' )
109
-
110
- def serverUrlBase = ' https://repository.sonatype.org:443/service/local/'
111
-
112
- repositories {
113
- maven {
114
- name = ' rso'
115
- url = serverUrlBase + ' staging/deploy/maven2/'
116
- credentials {
117
- username = sonatypeUsername
118
- password = sonatypePassword
90
+ publications {
91
+ maven(MavenPublication ) {
92
+ from components. java
93
+ groupId = ' org.sonatype.gradle.plugins'
94
+ artifactId = project. name
95
+ version = project. version. toString()
96
+
97
+ pom {
98
+ name = project. name
99
+ description = pluginDescription
100
+ url = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin'
101
+ organization {
102
+ name = ' Sonatype'
103
+ url = ' https://www.sonatype.com'
119
104
}
120
- }
121
- }
122
-
123
- nexusStaging {
124
- serverUrl = serverUrlBase
125
- stagingProfileId = ' 97306992c3c7ca'
126
- username = sonatypeUsername
127
- password = sonatypePassword
128
- numberOfRetries = 40
129
- delayBetweenRetriesInMillis = 5000
130
- }
131
-
132
- publications {
133
- withType(MavenPublication ) {
134
- pom {
135
- name = project. name
136
- description = pluginDescription
137
- url = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin'
138
- organization {
139
- name = ' Sonatype'
140
- url = ' https://www.sonatype.org'
141
- }
142
- issueManagement {
143
- system = ' GitHub'
144
- url = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin/issues'
145
- }
146
- licenses {
147
- license {
148
- name = ' The Apache Software License, Version 2.0'
149
- url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
150
- distribution = ' repo'
151
- }
105
+ issueManagement {
106
+ system = ' GitHub'
107
+ url = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin/issues'
108
+ }
109
+ licenses {
110
+ license {
111
+ name = ' The Apache Software License, Version 2.0'
112
+ url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
113
+ distribution = ' repo'
152
114
}
153
- scm {
154
- connection = ' scm:git:git://github.com/sonatype-nexus-community/scan-gradle-plugin.git'
155
- developerConnection
= ' scm:git:ssh://[email protected] :sonatype-nexus-community/scan-gradle-plugin.git'
156
- url = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin'
115
+ }
116
+ scm {
117
+ connection = ' scm:git:git://github.com/sonatype-nexus-community/scan-gradle-plugin.git'
118
+ developerConnection
= ' scm:git:ssh://[email protected] :sonatype-nexus-community/scan-gradle-plugin.git'
119
+ url = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin'
120
+ }
121
+ developers {
122
+ developer {
123
+ name = ' Guillermo Varela'
157
124
}
158
- developers {
159
- developer {
160
- name = ' Guillermo Varela'
161
- }
162
- developer {
163
- name = ' Usman Shaikh'
164
- }
125
+ developer {
126
+ name = ' Usman Shaikh'
165
127
}
166
128
}
167
-
168
- artifactId = project. name
169
129
}
170
130
}
131
+ }
132
+ repositories {
133
+ maven {
134
+ url = layout. buildDirectory. dir(' staging-deploy' )
135
+ }
136
+ }
137
+ }
171
138
172
- // configure signing if performing release
173
- if (' do-release' == System . getenv(' CIRCLE_JOB' )) {
174
- signing {
175
- def final encodedKey = System . getenv(' SECRING_GPG_ASC_BASE64' )
176
- def final signingKey = new String (encodedKey. decodeBase64())
177
-
178
- allprojects {
179
- println ' setup gpg signing with in-memory key'
180
- useInMemoryPgpKeys(
181
- signingKey,
182
- System . getenv(' GPG_PASSPHRASE' )
183
- )
184
- }
139
+ // Plugin publishing configuration
140
+ def pluginUrl = ' https://github.com/sonatype-nexus-community/scan-gradle-plugin'
141
+ pluginBundle {
142
+ website = pluginUrl
143
+ vcsUrl = pluginUrl
144
+ description = pluginDescription
145
+ tags = [' sonatype' , ' scan' , ' dependencies' , ' ossindex' , ' iq server' ]
146
+ System . setProperty(' gradle.publish.key' , System . getenv(' GRADLE_PUBLISH_KEY' ) ?: ' ' )
147
+ System . setProperty(' gradle.publish.secret' , System . getenv(' GRADLE_PUBLISH_SECRET' ) ?: ' ' )
148
+ }
185
149
186
- sign publishing. publications. pluginMaven
187
- sign publishing. publications. scanPluginMarkerMaven
150
+ jreleaser {
151
+ signing {
152
+ active = ' ALWAYS'
153
+ armored = true
154
+ }
155
+ deploy {
156
+ maven {
157
+ mavenCentral {
158
+ sonatype {
159
+ active = ' ALWAYS'
160
+ url = ' https://central.sonatype.com/api/v1/publisher'
161
+ stagingRepository(' build/staging-deploy' )
162
+ }
188
163
}
189
164
}
190
165
}
191
166
}
192
167
168
+ if (System . getenv(' RELEASE_BUILD' ) == ' true' ) {
169
+ signing {
170
+ def final encodedKey = System . getenv(' GPG_SIGNING_KEY' )
171
+ def final signingKey = new String (encodedKey. decodeBase64())
172
+ allprojects {
173
+ println ' setup gpg signing with in-memory key'
174
+ useInMemoryPgpKeys(
175
+ signingKey,
176
+ System . getenv(' GPG_PASSPHRASE' )
177
+ )
178
+ }
179
+ sign publishing. publications. maven
180
+ }
181
+ }
182
+
193
183
afterReleaseBuild. dependsOn publish
194
184
publish. finalizedBy closeAndReleaseRepository
195
185
publish. finalizedBy publishPlugins
0 commit comments