Skip to content

Commit

Permalink
build: sign artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubxity committed Oct 23, 2021
1 parent 3e6f89c commit aef1ef5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Configure GPG Key
run: |
echo -n "SIGNING_KEY" | base64 --decode > /tmp/keyring.gpg
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
Expand All @@ -17,7 +22,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assemble publish --no-daemon
run: ./gradlew assemble publish --no-daemon -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password= -Psigning.secretKeyRingFile=/tmp/keyring.gpg
env:
MAVEN_REPO_USER: ${{ secrets.MAVEN_REPO_USER }}
MAVEN_REPO_PASS: ${{ secrets.MAVEN_REPO_PASS }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Configure GPG Key
run: |
echo -n "SIGNING_KEY" | base64 --decode > /tmp/keyring.gpg
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
Expand All @@ -17,7 +22,7 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assemble publish --no-daemon
run: ./gradlew assemble publish --no-daemon -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password= -Psigning.secretKeyRingFile=/tmp/keyring.gpg
env:
MAVEN_REPO_USER: ${{ secrets.MAVEN_REPO_USER }}
MAVEN_REPO_PASS: ${{ secrets.MAVEN_REPO_PASS }}
Expand Down
6 changes: 5 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ publishing {
}
}
}
}
}

signing {
sign(publishing.publications["mavenJava"])
}
14 changes: 9 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ allprojects {
subprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "signing")
apply(plugin = "maven-publish")

tasks.withType<KotlinCompile> {
Expand All @@ -46,11 +47,6 @@ subprojects {
freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
}
}
afterEvaluate {
tasks.findByName("shadowJar")?.also {
tasks.named("assemble") { dependsOn(it) }
}
}
configure<PublishingExtension> {
repositories {
maven {
Expand All @@ -67,4 +63,12 @@ subprojects {
}
}
}
afterEvaluate {
tasks.findByName("shadowJar")?.also {
tasks.named("assemble") { dependsOn(it) }
}
configure<SigningExtension> {
sign(tasks.findByName("shadowJar") ?: tasks["jar"])
}
}
}

0 comments on commit aef1ef5

Please sign in to comment.