Skip to content

Commit

Permalink
OSSRH publishing (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
big-andy-coates authored Jan 24, 2023
1 parent 1d6c722 commit 4f20453
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ jobs:
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_SONA_USERNAME: ${{ secrets.SONA_USERNAME }}
ORG_GRADLE_PROJECT_SONA_PASSWORD: ${{ secrets.SONA_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew cV
./gradlew publish
./gradlew publish closeSonatypeStagingRepository # todo: switch to closeAndReleaseStagingRepository to auto release.
create-gh-release:
if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-alpha')
Expand Down
19 changes: 18 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id("com.github.spotbugs") version "4.7.2"
id("com.diffplug.spotless") version "6.11.0"
id("pl.allegro.tech.build.axion-release") version "1.14.3"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

project.version = scmVersion.version
Expand Down Expand Up @@ -163,7 +164,6 @@ subprojects {
}

publishing {

repositories {
maven {
name = "GitHubPackages"
Expand Down Expand Up @@ -240,4 +240,21 @@ subprojects {
}
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

if (project.hasProperty("SONA_USERNAME")) {
username.set(project.property("SONA_USERNAME").toString())
}

if (project.hasProperty("SONA_PASSWORD")) {
password.set(project.property("SONA_PASSWORD").toString())
}
}
}
}

defaultTasks("format", "static", "check")

0 comments on commit 4f20453

Please sign in to comment.