@@ -29,22 +29,6 @@ afterEvaluate {
2929 }
3030}
3131
32- /**
33- * Retrieves property `ossrhPassword` stored in the gradle.properties file (in project or gradle user-root folder)
34- * @return
35- */
36- def getOSSRHRepositoryPassword () {
37- return hasProperty(' ossrhPassword' ) ? ossrhPassword : System . getenv(" OSSRH_PASSWORD" ) != null ? System . getenv(" OSSRH_PASSWORD" ) : " "
38- }
39-
40- /**
41- * Retrieves property `ossrhUsername` stored in the gradle.properties file (in project or gradle user-root folder)
42- * @return
43- */
44- def getOSSRHRepositoryUsername () {
45- return hasProperty(' ossrhUsername' ) ? ossrhUsername : System . getenv(" OSSRH_USERNAME" ) != null ? System . getenv(" OSSRH_USERNAME" ) : " "
46- }
47-
4832def getGithubPublishUsername () {
4933 return hasProperty(' githubUsername' ) ? githubUsername : System . getenv(" GITHUB_USERNAME" ) != null ? System . getenv(" GITHUB_USERNAME" ) : " "
5034}
@@ -53,15 +37,15 @@ def getGithubPackagesAccessToken() {
5337 return hasProperty(' githubAccessToken' ) ? githubAccessToken : System . getenv(" GITHUB_ACCESS_TOKEN" ) != null ? System . getenv(" GITHUB_ACCESS_TOKEN" ) : " "
5438}
5539
56- static def getDate () {
57- return new Date (). format(' yyyy-MM-dd HH:mm:ss' )
58- }
59-
6040
6141/**
62- * Run ./gradlew :utils:clean && ./gradlew :utils:assembleRelease && ./gradlew :utils:publish
63- * Run ./gradlew :library:clean && ./gradlew :library:assembleRelease && ./gradlew :library:publish
64- * This publishes to all production artefact repositories
42+ * GitHub Packages:
43+ * Run ./gradlew :utils:clean && ./gradlew :utils:assembleRelease && ./gradlew :utils:publishMavenJavaPublicationToGitHubPackagesRepository
44+ * Run ./gradlew :library:clean && ./gradlew :library:assembleRelease && ./gradlew :library:publishMavenJavaPublicationToGitHubPackagesRepository
45+ *
46+ * Maven Central (via Sonatype Central Portal):
47+ * Run ./gradlew clean assembleRelease publishToSonatype closeAndReleaseSonatypeStagingRepository
48+ * Requires ossrhUsername and ossrhPassword in gradle.properties or OSSRH_USERNAME/OSSRH_PASSWORD env vars
6549 */
6650
6751afterEvaluate {
@@ -142,35 +126,8 @@ afterEvaluate {
142126 password = getGithubPackagesAccessToken()
143127 }
144128 }
145-
146- maven {
147- name = " MavenCentral"
148- /* * Configure path of your package repository on Github
149- * Replace GITHUB_USERID with your or organisation Github userID and REPOSITORY with the repository name on GitHub
150- * e.g. "https://maven.pkg.github.com/opensrp/opensrp-client-reporting"
151- */
152-
153- def repositoryURL
154- def timestampMsg = " at " + getDate()
155- if (! version. contains(" SNAPSHOT" )) {
156- println ' PROCESSING MAVEN RELEASE BUILD VERSION ' + project. VERSION_NAME + timestampMsg + ' ...'
157- repositoryURL = hasProperty(' RELEASE_REPOSITORY_URL' ) ? RELEASE_REPOSITORY_URL
158- : " https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
159- } else {
160- println ' PROCESSING MAVEN REMOTE SNAPSHOT BUILD VERSION ' + project. VERSION_NAME + timestampMsg + ' ...'
161- repositoryURL = hasProperty(' SNAPSHOT_REPOSITORY_URL' ) ? SNAPSHOT_REPOSITORY_URL
162- : " https://s01.oss.sonatype.org/content/repositories/snapshots/"
163-
164- }
165- url = uri(repositoryURL)
166- credentials {
167- /* * Create gradle.properties in root project folder file with
168- * ossrhUsername=GITHUB_USER_ID & ossrhPassword=PERSONAL_ACCESS_TOKEN
169- */
170- username = getOSSRHRepositoryUsername()
171- password = getOSSRHRepositoryPassword()
172- }
173- }
129+ // Maven Central publishing is handled by the io.github.gradle-nexus.publish-plugin
130+ // configured in the root build.gradle. Run ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
174131 }
175132 }
176133
0 commit comments