Skip to content

Commit

Permalink
fix signing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mscheong01 committed Apr 2, 2023
1 parent b882de7 commit 9910e2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:
with:
java-version: '17'

- name: Build and publish with Gradle
- name: Sign and publish with Gradle
working-directory: ./
run: ./gradlew build test publish -PreleaseVersion=${{ steps.previous_tag.outputs.tag }}
run: ./gradlew sign test publish -PreleaseVersion=${{ steps.previous_tag.outputs.tag }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
Expand Down
23 changes: 14 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ subprojects {
plugin("com.google.protobuf")
plugin("maven-publish")
plugin("org.jlleitschuh.gradle.ktlint")
plugin("signing")
}

group = rootProject.group
Expand Down Expand Up @@ -103,6 +104,19 @@ subprojects {
}
}
}

signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["maven"])
}

tasks.withType<Sign>().configureEach {
onlyIf {
project.hasProperty("releaseVersion")
}
}
}

tasks.create("updateVersion") {
Expand All @@ -116,12 +130,3 @@ tasks.create("updateVersion") {
}
}
}

if (project.hasProperty("releaseVersion")) {
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}
}

0 comments on commit 9910e2e

Please sign in to comment.