Skip to content

Commit af14815

Browse files
committed
Add GPG key injection.
1 parent 24665fc commit af14815

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,24 @@ jobs:
2626
with:
2727
java-version: 17
2828

29+
- name: Import GPG key
30+
id: import_gpg
31+
uses: crazy-max/ghaction-import-gpg@e37acbdf6e46d8be3f11008297e2964d5f68adef
32+
with:
33+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
34+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
35+
- name: List keys
36+
run: gpg -K
37+
2938
- name: Install packages
3039
run: gradle wrapper
3140
- name: Validate Gradle wrapper
3241
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
3342

3443
- name: Run build and test
3544
run: ./gradlew build --info
45+
env:
46+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3647

3748
- name: Create Github Release and Tag
3849
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name == 'push'
@@ -44,5 +55,6 @@ jobs:
4455
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name == 'push'
4556
run: gradle publish
4657
env:
58+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
4759
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4860
MAVEN_OSSRH_TOKEN: ${{ secrets.MAVEN_OSSRH_TOKEN }}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ publishing {
9797
}
9898

9999
signing {
100-
useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PASSPHRASE"))
100+
useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), "")
101101
sign(publishing.publications["mavenJava"])
102102
}

0 commit comments

Comments
 (0)