Skip to content

Commit 6032e18

Browse files
Publish to Sonatype
connected: #38
1 parent d9a2eef commit 6032e18

File tree

5 files changed

+24
-49
lines changed

5 files changed

+24
-49
lines changed

.github/workflows/ci.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
distribution: 'adopt'
6969

7070
- name: 3. Build on ${{ matrix.os }} with Java ${{ matrix.java }}
71-
run: ./gradlew build bintrayUpload idea -PbintrayDryRun
71+
run: ./gradlew build idea
7272

7373
#
7474
# Release job, only for pushes to the main development branch
@@ -97,15 +97,10 @@ jobs:
9797
distribution: 'adopt'
9898

9999
- name: Build and publish to Bintray/MavenCentral
100-
run: |
101-
# Print output every minute to avoid Github Actions timeout
102-
while sleep 1m; do echo "=====[ $SECONDS seconds elapsed -- still running ]====="; done &
103-
./gradlew bintrayUpload githubRelease
104-
# Killing background sleep loop
105-
kill %1
100+
run: ./gradlew publishToSonatype closeAndReleaseStagingRepository githubRelease
106101
env:
107102
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
108-
BINTRAY_API_KEY: ${{secrets.BINTRAY_API_KEY}}
109103
NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}}
110104
NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}}
111-
105+
PGP_KEY: ${{secrets.PGP_KEY}}
106+
PGP_PWD: ${{secrets.PGP_PWD}}

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Mockito utility classes for easy integration with TestNG
55
[![CI](https://github.com/mockito/mockito-testng/workflows/CI/badge.svg)](https://github.com/mockito/mockito-testng/actions?query=workflow%3ACI)
66

77
[![Maven Central](https://img.shields.io/maven-central/v/org.mockito/mockito-testng.svg)](https://search.maven.org/artifact/org.mockito/mockito-testng/)
8-
[![Bintray](https://img.shields.io/bintray/v/mockito/maven/mockito-testng)](https://bintray.com/mockito/maven/mockito-testng/_latestVersion)
98

109
## Installation
1110

build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ buildscript {
55
}
66
}
77
dependencies {
8-
classpath "org.shipkit:shipkit-auto-version:1.+"
9-
classpath "org.shipkit:shipkit-changelog:1.+"
10-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
8+
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
9+
classpath 'org.shipkit:shipkit-changelog:1.1.15'
10+
classpath 'org.shipkit:shipkit-auto-version:1.1.11'
1111
}
1212
}
1313

gradle/java-publication.gradle

+16-35
Original file line numberDiff line numberDiff line change
@@ -84,43 +84,24 @@ publishing {
8484
//fleshes out problems with Maven pom generation when building
8585
tasks.build.dependsOn("publishJavaLibraryPublicationToMavenLocal")
8686

87-
//Bintray Gradle plugin configuration (https://github.com/bintray/gradle-bintray-plugin)
88-
//Plugin jars are added to the buildscript classpath in the root build.gradle file
89-
apply plugin: "com.jfrog.bintray"
90-
91-
bintray {
92-
//We need to use some user id here, because the Bintray key is associated with the user
93-
//However, any user id is good, so longer the user has necessary privileges to the repository
94-
user = 'szczepiq' //https://bintray.com/szczepiq
95-
key = System.getenv('BINTRAY_API_KEY')
96-
publish = true //can be changed to 'false' for testing
97-
dryRun = project.hasProperty("bintrayDryRun")
98-
99-
// allow override in order to possibility re-run job if something failed
100-
// especially Maven Central sync
101-
// https://github.com/mockito/mockito-testng/issues/26
102-
override = true
103-
104-
publications = ['javaLibrary']
105-
106-
pkg {
107-
repo = 'maven' //https://bintray.com/mockito/maven
108-
userOrg = 'mockito' //https://bintray.com/mockito
109-
110-
name = "mockito-testng"
111-
112-
licenses = ['MIT']
113-
labels = ['testng', 'mockito']
114-
vcsUrl = "https://github.com/mockito/mockito-testng.git"
87+
apply plugin: 'signing' //https://docs.gradle.org/current/userguide/signing_plugin.html
88+
signing {
89+
if (System.getenv('PGP_KEY')) {
90+
useInMemoryPgpKeys(System.getenv('PGP_KEY'), System.getenv('PGP_PWD'))
91+
sign publishing.publications.javaLibrary
92+
}
93+
}
11594

116-
version {
117-
name = project.version
118-
vcsTag = "v$project.version"
95+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
96+
nexusPublishing {
97+
repositories {
98+
if (System.getenv('NEXUS_TOKEN_PWD')) {
99+
sonatype {
100+
// Publishing to: https://s01.oss.sonatype.org (faster instance)
101+
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
102+
snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
119103

120-
//Notable versions are automatically synced to Maven Central repository (https://oss.sonatype.org/)
121-
mavenCentralSync {
122-
sync = true
123-
user = System.getenv('NEXUS_TOKEN_USER')
104+
username = System.getenv('NEXUS_TOKEN_USER')
124105
password = System.getenv('NEXUS_TOKEN_PWD')
125106
}
126107
}

version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.3.*
1+
version=0.4.*

0 commit comments

Comments
 (0)