Skip to content

Commit

Permalink
Try to wire signing into publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Oct 11, 2023
1 parent f657cf5 commit f7181a7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/publish-android-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
echo "${{ secrets.OSSRH_GPG }}" > private-key.asc
gpg --import --batch private-key.asc
echo "SIGNING_SECRET_KEY_RING_FILE=$(pwd)/private-key.asc" >> $GITHUB_ENV
echo "SIGNING_KEY=`cat $(pwd)/private-key.asc`" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v2
Expand All @@ -41,6 +41,5 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
working-directory: ./src/AndroidClient
run: ./gradlew android:publishAllPublicationsToOSSRHRepository -Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} -Psigning.secretKeyRingFile=${{ env.SIGNING_SECRET_KEY_RING_FILE }}
run: ./gradlew android:publishAllPublicationsToOSSRHRepository -Psigning.key=${{ env.SIGNING_KEY }}
5 changes: 2 additions & 3 deletions .github/workflows/publish-client-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
echo "${{ secrets.OSSRH_GPG }}" > private-key.asc
gpg --import --batch private-key.asc
echo "SIGNING_SECRET_KEY_RING_FILE=$(pwd)/private-key.asc" >> $GITHUB_ENV
echo "SIGNING_KEY=`cat $(pwd)/private-key.asc`" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v2
Expand All @@ -41,6 +41,5 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
working-directory: ./src/AndroidClient
run: ./gradlew client:publishAllPublicationsToOSSRHRepository -Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} -Psigning.secretKeyRingFile=${{ env.SIGNING_SECRET_KEY_RING_FILE }}
run: ./gradlew client:publishAllPublicationsToOSSRHRepository -Psigning.key=${{ env.SIGNING_KEY }}
6 changes: 4 additions & 2 deletions src/AndroidClient/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ publishing {
}


if (project.hasProperty('signing.keyId')) {

if (project.hasProperty('signing.key')) {
println "Signing enabled"
signing {
sign publishing.publications.mavenJava
useInMemoryPgpKeys(findProperty("signing.keyId") as String, null)
useInMemoryPgpKeys(findProperty("signing.key") as String, null)
//useGpgCmd(findProperty("signing.secretKeyRingFile"))
}
} else {
println "Signing disabled"
Expand Down
25 changes: 17 additions & 8 deletions src/AndroidClient/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ dependencies {
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
}

// Additional tasks for generating source and Javadoc JARs
task sourcesJar(type: Jar) {
task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
archiveClassifier.set('sources')
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
archiveClassifier.set('javadoc')
}

artifacts {
archives jar
archives sourceJar
archives javadocJar
}

// Configure the publishing block for Maven Central deployment
Expand All @@ -36,8 +41,12 @@ publishing {
from components.java

// Attach source and javadoc JARs
artifact sourcesJar
artifact javadocJar
artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}

pom {
name = 'ServiceStack.Client'
Expand Down Expand Up @@ -95,11 +104,11 @@ publishing {
}
}

if (project.hasProperty('signing.keyId')) {
if (project.hasProperty('signing.key')) {
println "Signing enabled"
signing {
sign publishing.publications.mavenJava
useInMemoryPgpKeys(findProperty("signing.keyId") as String, null)
useInMemoryPgpKeys(findProperty("signing.key") as String, null)
//useGpgCmd(findProperty("signing.secretKeyRingFile"))
}
} else {
Expand Down

0 comments on commit f7181a7

Please sign in to comment.