Skip to content

Commit 8a7bc7f

Browse files
committed
Migrate to Central Portal OSSRH Staging API
Closes gh-33
1 parent c3edac3 commit 8a7bc7f

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

.github/workflows/gradle.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ jobs:
6262
env:
6363
SECRING_FILE: ${{ secrets.SECRING_FILE }}
6464
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
65-
- name: Publish to Sonatype OSSRH
65+
- name: Publish to Maven Central Portal
6666
id: publish
6767
env:
68-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
69-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
70-
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
71-
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
68+
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
69+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
7270
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
7371
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
7472
SECRING_FILE: ${{ secrets.SECRING_FILE }}

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@ jobs:
6969
env:
7070
SECRING_FILE: ${{ secrets.SECRING_FILE }}
7171
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
72-
- name: Publish to Sonatype OSSRH
72+
- name: Publish to Maven Central Portal
7373
id: publish
7474
if: steps.secring.outcome == 'success'
7575
env:
76-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
77-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
78-
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
79-
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
76+
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
77+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
8078
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
8179
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
8280
SECRING_FILE: ${{ secrets.SECRING_FILE }}

build.gradle

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ buildscript {
33
// mavenLocal()
44
mavenCentral()
55
gradlePluginPortal()
6+
maven {
7+
name = 'Maven Central Portal Snapshots'
8+
url = 'https://central.sonatype.com/repository/maven-snapshots/'
9+
10+
content {
11+
includeGroupAndSubgroups 'org.graceframework'
12+
}
13+
mavenContent {
14+
snapshotsOnly()
15+
}
16+
}
617
}
718
dependencies {
819
classpath "org.graceframework:grace-gradle-plugin:$graceVersion"
@@ -23,8 +34,6 @@ ext {
2334
isBuildSnapshot = project.version.endsWith("-SNAPSHOT")
2435
isReleaseVersion = !isBuildSnapshot
2536
servletApiVersion = "6.0.0"
26-
nexusUsername = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
27-
nexusPassword = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
2837
}
2938

3039
ext."signing.keyId" = System.getenv("SIGNING_KEY") ?: project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : null
@@ -39,14 +48,12 @@ apply plugin: 'org.graceframework.grace-doc'
3948
nexusPublishing {
4049
repositories {
4150
sonatype {
42-
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
43-
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
44-
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : ''
45-
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
46-
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
47-
username = ossUser
48-
password = ossPass
49-
stagingProfileId = ossStagingProfileId
51+
def mavenUser = System.getenv("MAVEN_CENTRAL_USER") ?: project.hasProperty("mavenCentralUsername") ? project.mavenCentralUsername : ''
52+
def mavenPass = System.getenv("MAVEN_CENTRAL_PASSWORD") ?: project.hasProperty("mavenCentralPassword") ? project.mavenCentralPassword : ''
53+
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
54+
snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
55+
username = mavenUser
56+
password = mavenPass
5057
}
5158
}
5259
}
@@ -58,10 +65,15 @@ allprojects {
5865

5966
repositories {
6067
mavenCentral()
61-
if (project.projectVersion.endsWith('-SNAPSHOT')) {
62-
maven {
63-
name = 'Sonatype OSS Snapshot Repo'
64-
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
68+
maven {
69+
name = 'Maven Central Portal Snapshots'
70+
url = 'https://central.sonatype.com/repository/maven-snapshots/'
71+
72+
content {
73+
includeGroupAndSubgroups 'org.graceframework'
74+
}
75+
mavenContent {
76+
snapshotsOnly()
6577
}
6678
}
6779
}

0 commit comments

Comments
 (0)