diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 33f99e0..a950ed2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -48,6 +48,8 @@ jobs: ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }} ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }} + ORG_GRADLE_PROJECT_githubUser: ${{ github.actor }} + ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUB_TOKEN }} # com.javiersc.semver.gradle.plugin should pick the actual tag run: ./gradlew publish -Ppublish.central=true --stacktrace diff --git a/build-logic/src/main/kotlin/fireplace.maven-publication.gradle.kts b/build-logic/src/main/kotlin/fireplace.maven-publication.gradle.kts index e297df0..73009ad 100644 --- a/build-logic/src/main/kotlin/fireplace.maven-publication.gradle.kts +++ b/build-logic/src/main/kotlin/fireplace.maven-publication.gradle.kts @@ -74,14 +74,16 @@ publishing { } } - if (isGithubRelease) { - logger.lifecycle("Publishing to GitHubPackages") + val ghUser = properties("githubUser") + val ghToken = properties("githubToken") + if (isGithubRelease && ghUser != "null" && ghToken != "null") { + logger.lifecycle("Will be publishing to GitHubPackages") maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/bric3/fireplace") credentials { - username = providers.environmentVariable("GITHUB_USER").get() - password = providers.environmentVariable("GITHUB_TOKEN").get() + username = ghUser + password = ghToken } } } @@ -99,9 +101,9 @@ publishing { signing { setRequired({ gradle.taskGraph.hasTask("publish") }) useInMemoryPgpKeys( - // findProperty("signingKeyId") as? String, - findProperty("signingKey") as? String, - findProperty("signingPassword") as? String + // properties("signingKeyId") as? String, + properties("signingKey"), + properties("signingPassword") as? String ) sign(publishing.publications) }