Skip to content

Commit d7abd87

Browse files
authored
fix: CD to Maven Central (#3)
* Configuring key and passphrase via settings.xml * Verify GPG Signing * Adding developers info * Ignoring secrets and env variables for act
1 parent 83205bf commit d7abd87

5 files changed

Lines changed: 45 additions & 7 deletions

File tree

.changeset/twenty-donuts-dance.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"magicbell-java-client": patch
3+
---
4+
5+
Fixes CD to Maven Central

.github/workflows/publish.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
release:
55
types: [created]
66
workflow_dispatch:
7-
7+
88
jobs:
99
publish:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Checkout code
12+
- name: Checkout code
1313
uses: actions/checkout@v4
1414

1515
- name: Install gpg secret key
@@ -19,12 +19,25 @@ jobs:
1919
- name: Set up Maven Central Repository
2020
uses: actions/setup-java@v4
2121
with:
22-
java-version: '8'
23-
distribution: 'temurin'
22+
java-version: "8"
23+
distribution: "temurin"
2424
server-id: central
2525
server-username: MAVEN_USERNAME
2626
server-password: MAVEN_PASSWORD
27-
27+
gpg-private-key: ${{ secrets.MAVEN_KEY }}
28+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
29+
30+
- name: Verify GPG signing works
31+
run: |
32+
mvn \
33+
--no-transfer-progress \
34+
-Dgpg.keyname=${{ secrets.MAVEN_KEY_ID }} \
35+
verify gpg:sign
36+
env:
37+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
38+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
39+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_KEY_PASSWORD }}
40+
2841
- name: Publish package
2942
run: |
3043
mvn \
@@ -35,4 +48,4 @@ jobs:
3548
env:
3649
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
3750
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
38-
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_KEY_PASSWORD }}
51+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_KEY_PASSWORD }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
node_modules/
33
target
44

5-
docs-dist
5+
docs-dist
6+
7+
# act
8+
.env
9+
.secrets

liblab.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"java": {
2828
"groupId": "com.magicbell.client",
2929
"artifactId": "magicbell-java-client",
30+
"developers": [{
31+
"name": "Ullrich Schäfer",
32+
"email": "ullrich@magicbell.io",
33+
"organization": "MagicBell",
34+
"organizationUrl": "https://www.magicbell.com"
35+
}],
3036
"githubRepoName": "magicbell-java-client",
3137
"ignoreFiles": [],
3238
"includeKotlinSnippets": true,

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
<url>https://github.com/magicbell/magicbell-java-client</url>
2323
</scm>
2424

25+
<!-- See https://central.sonatype.org/publish/requirements/#developer-information -->
26+
<developers>
27+
<developer>
28+
<name>Ullrich Schäfer</name>
29+
<email>ullrich@magicbell.io</email>
30+
<organization>MagicBell</organization>
31+
<organizationUrl>https://www.magicbell.com</organizationUrl>
32+
</developer>
33+
</developers>
34+
2535
<licenses>
2636
<license>
2737
<name>MIT</name>

0 commit comments

Comments
 (0)