Repository: miracum/kafka-fhir-serializer
Pull request #66: fix: fixed central publishing and switched to release-please
Author: login: chgl
Created: 2025-04-10T18:10:50Z | Merged: 2025-04-10T18:15:23Z



Diff:
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index c8f2968..ee2f9ad 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -32,12 +32,13 @@ jobs:
         uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
 
       - name: Build with Gradle
-        run: ./gradlew build
+        run: |
+          ./gradlew build
 
       - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
         with:
           name: package
-          path: build/libs
+          path: build/
 
       - name: Run Tests
         run: ./gradlew test
@@ -45,14 +46,11 @@ jobs:
       - name: Run Test Coverage
         run: ./gradlew jacocoTestReport
 
-      - name: Generate JaCoCo Badge
-        uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 # v2.11.0
-        with:
-          jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
-
-      - name: Publish package
+      - name: Publish to central
         if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
-        run: ./gradlew publish
+        run: |
+          ./gradlew publish
+          ./gradlew publishToMavenCentralPortal
         env:
           OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
           OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml
new file mode 100644
index 0000000..3dac835
--- /dev/null
+++ b/.github/workflows/release-please.yaml
@@ -0,0 +1,20 @@
+name: release-please
+
+on:
+  push:
+    branches:
+      - master
+
+permissions:
+  contents: read
+
+jobs:
+  release-please:
+    runs-on: ubuntu-24.04
+    permissions:
+      contents: write
+      pull-requests: write
+    steps:
+      - uses: googleapis/release-please-action@d1a8f221d7723166f48a584aebba00ef3f6febec # v4.1.4
+        with:
+          token: ${{ secrets.MIRACUM_BOT_SEMANTIC_RELEASE_TOKEN }}
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
new file mode 100644
index 0000000..47fb725
--- /dev/null
+++ b/.release-please-manifest.json
@@ -0,0 +1,3 @@
+{
+  ".": "2.0.2"
+}
diff --git a/README.md b/README.md
index 998e136..472236f 100644
--- a/README.md
+++ b/README.md
@@ -7,23 +7,31 @@ Kafka De-/Serializer for FHIR® resources in JSON format.
 
 ## Installation
 
+### Gradle
+
+<!-- x-release-please-start-version -->
+
+```groovy
+// https://mvnrepository.com/artifact/org.miracum/kafka-fhir-serializer
+implementation "org.miracum:kafka-fhir-serializer:2.0.2"
+```
+
+<!-- x-release-please-end -->
+
 ### Maven
 
+<!-- x-release-please-start-version -->
+
 ```xml
 <!-- https://mvnrepository.com/artifact/org.miracum/kafka-fhir-serializer -->
 <dependency>
     <groupId>org.miracum</groupId>
     <artifactId>kafka-fhir-serializer</artifactId>
-    <version>2.0.1</version>
+    <version>2.0.2</version>
 </dependency>
 ```
 
-### Gradle
-
-```groovy
-// https://mvnrepository.com/artifact/org.miracum/kafka-fhir-serializer
-implementation "org.miracum:kafka-fhir-serializer:2.0.1"
-```
+<!-- x-release-please-end -->
 
 ## Usage
 
@@ -42,13 +50,12 @@ spring:
 
 ## Development
 
-### Release
+The project uses <https://github.com/googleapis/release-please> for versioning.
 
-See <https://central.sonatype.org/publish/publish-guide/> for a general overview.
-
-1. update version in `build.gradle` to a release version (ie. without the `-SNAPSHOT`) and update the version in the `README.md` as well
+1. work on fixes and features in a seperate fork or branch
 1. commit the changes
-1. create a GitHub release for the previous commit
-1. the CI should now run and publish a new package
-1. follow the instructions over at <https://central.sonatype.org/publish/release/> to promote the package from staging to the release repo
-1. increment the version number in `build.gradle` to a new snapshot version (i.e. 2.0.0-SNAPSHOT) and continue development
+1. create a pull request against the master branch
+1. once reviewed and merged, a new PR should appear to release the changes as a new version
+1. merge this PR to create the release on both GitHub and publish to Maven central
+
+See <https://central.sonatype.org/publish/publish-portal-guide/> for a general overview.
diff --git a/build.gradle b/build.gradle
index 93581f7..679ad0d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,10 +6,12 @@ plugins {
     id 'signing'
     id 'com.diffplug.spotless' version '7.0.3'
     id 'jacoco'
+    id 'io.gitee.pkmer.sonatype-central-publisher' version '1.1.0'
+
 }
 
 group = 'org.miracum'
-version = '2.0.2'
+version = '2.0.2' // x-release-please-version
 
 java {
     withJavadocJar()
@@ -79,7 +81,7 @@ publishing {
                     }
                 }
                 scm {
-                    connection = 'scm:git:git://github.com/miracum/kafka-fhir-serializer.git'
+                    connection = 'scm:git:https://github.com/miracum/kafka-fhir-serializer.git'
                     developerConnection = 'scm:git:ssh://github.com:miracum/kafka-fhir-serializer.git'
                     url = 'https://github.com/miracum/kafka-fhir-serializer'
                 }
@@ -88,13 +90,8 @@ publishing {
     }
     repositories {
         maven {
-            def releasesRepoUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
-            def snapshotsRepoUrl = 'https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/'
-            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
-            credentials {
-                username = System.getenv('OSSRH_USERNAME')
-                password = System.getenv('OSSRH_PASSWORD')
-            }
+            name = "Local"
+            url = layout.buildDirectory.dir('repos/bundles')
         }
     }
 }
@@ -112,6 +109,19 @@ signing {
     sign publishing.publications.mavenJava
 }
 
+pkmerBoot {
+    sonatypeMavenCentral{
+        // the same with publishing.repositories.maven.url in the configuration.
+        stagingRepository = layout.buildDirectory.dir("repos/bundles")
+        /**
+         * get username and password from
+         * <a href="https://central.sonatype.com/account"> central sonatype account</a>
+         */
+        username = System.getenv('OSSRH_USERNAME')
+        password = System.getenv('OSSRH_PASSWORD')
+    }
+}
+
 spotless {
     java {
         importOrder()
diff --git a/release-please-config.json b/release-please-config.json
new file mode 100644
index 0000000..47b296a
--- /dev/null
+++ b/release-please-config.json
@@ -0,0 +1,25 @@
+{
+  "$schema": "https://raw.githubusercontent.com/googleapis/release-please/refs/heads/main/schemas/config.json",
+  "bump-minor-pre-major": true,
+  "bump-patch-for-minor-pre-major": true,
+  "include-v-in-tag": true,
+  "extra-label": "release-please",
+  "release-type": "simple",
+  "packages": {
+    ".": {
+      "release-type": "simple",
+      "bump-minor-pre-major": true,
+      "bump-patch-for-minor-pre-major": true,
+      "extra-files": [
+        {
+          "type": "generic",
+          "path": "build.gradle"
+        },
+        {
+          "type": "generic",
+          "path": "README.md"
+        }
+      ]
+    }
+  }
+}
diff --git a/version.txt b/version.txt
new file mode 100644
index 0000000..e9307ca
--- /dev/null
+++ b/version.txt
@@ -0,0 +1 @@
+2.0.2


Reviews:
user: login: github-advanced-security[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-10T18:15:35Z

Review comments:
diff_hunk: @@ -6,10 +6,12 @@
     id 'signing'
     id 'com.diffplug.spotless' version '7.0.3'
     id 'jacoco'
+    id 'io.gitee.pkmer.sonatype-central-publisher' version '1.1.0'
+
path: build.gradle
user: login: github-advanced-security[bot]
body: ## Checks that code blocks such as method bodies, closures and control structure bodies do not end with an empty line.

Code block ends with a blank line.

[Show more details](https://github.com/miracum/kafka-fhir-serializer/security/code-scanning/30)
created_at: 2025-04-10T18:15:35Z
author_association: NONE
diff_hunk: @@ -88,13 +90,8 @@
     }
     repositories {
         maven {
-            def releasesRepoUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
-            def snapshotsRepoUrl = 'https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/'
-            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
-            credentials {
-                username = System.getenv('OSSRH_USERNAME')
-                password = System.getenv('OSSRH_PASSWORD')
-            }
+            name = "Local"
path: build.gradle
user: login: github-advanced-security[bot]
body: ## String objects should be created with single quotes, and GString objects created with double quotes. Creating normal String objects with double quotes is confusing to readers.

The String 'Local' can be wrapped in single quotes instead of double quotes

[Show more details](https://github.com/miracum/kafka-fhir-serializer/security/code-scanning/31)
created_at: 2025-04-10T18:15:35Z
author_association: NONE
diff_hunk: @@ -112,6 +109,19 @@
     sign publishing.publications.mavenJava
 }
 
+pkmerBoot {
+    sonatypeMavenCentral{
path: build.gradle
user: login: github-advanced-security[bot]
body: ## Check that there is at least one space (blank) or whitespace before each opening brace ("{") for method/class/interface declarations, closure expressions and block statements.

The opening brace for the closure in class None is not preceded by a space or whitespace

[Show more details](https://github.com/miracum/kafka-fhir-serializer/security/code-scanning/32)
created_at: 2025-04-10T18:15:35Z
author_association: NONE
diff_hunk: @@ -112,6 +109,19 @@
     sign publishing.publications.mavenJava
 }
 
+pkmerBoot {
+    sonatypeMavenCentral{
+        // the same with publishing.repositories.maven.url in the configuration.
+        stagingRepository = layout.buildDirectory.dir("repos/bundles")
path: build.gradle
user: login: github-advanced-security[bot]
body: ## String objects should be created with single quotes, and GString objects created with double quotes. Creating normal String objects with double quotes is confusing to readers.

The String 'repos/bundles' can be wrapped in single quotes instead of double quotes

[Show more details](https://github.com/miracum/kafka-fhir-serializer/security/code-scanning/33)
created_at: 2025-04-10T18:15:35Z
author_association: NONE

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-04-10T18:12:36Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=miracum_kafka-fhir-serializer&pullRequest=66) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=miracum_kafka-fhir-serializer&pullRequest=66&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=miracum_kafka-fhir-serializer&pullRequest=66&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=miracum_kafka-fhir-serializer&pullRequest=66&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=miracum_kafka-fhir-serializer&pullRequest=66&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=miracum_kafka-fhir-serializer&pullRequest=66&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=miracum_kafka-fhir-serializer&pullRequest=66)


author_association: NONE
user: login: github-actions[bot]
created_at: 2025-04-10T18:14:00Z
body: ## [🦙 MegaLinter](https://megalinter.io/8.5.0) status: ⚠️ [WARNING](https://github.com/miracum/kafka-fhir-serializer/actions/runs/14387358056)

| Descriptor  |                                               Linter                                                |Files|Fixed|                                    Errors                                    |Warnings|Elapsed time|
|-------------|-----------------------------------------------------------------------------------------------------|-----|-----|------------------------------------------------------------------------------|--------|------------|
|✅ ACTION    |[actionlint](https://megalinter.io/8.5.0/descriptors/action_actionlint)                              |    4|     |                                                                             0|       0|0.02s       |
|✅ BASH      |[bash-exec](https://megalinter.io/8.5.0/descriptors/bash_bash_exec)                                  |    1|     |                                                                             0|       0|0.01s       |
|✅ BASH      |[shellcheck](https://megalinter.io/8.5.0/descriptors/bash_shellcheck)                                |    1|     |                                                                             0|       0|0.11s       |
|⚠️ BASH      |[shfmt](https://megalinter.io/8.5.0/descriptors/bash_shfmt)                                          |    1|     |[1](https://github.com/miracum/kafka-fhir-serializer/actions/runs/14387358056)|       0|0.01s       |
|✅ GROOVY    |[npm-groovy-lint](https://megalinter.io/8.5.0/descriptors/groovy_npm_groovy_lint)                    |    2|     |                                                                             0|       0|12.69s      |
|✅ JAVA      |[checkstyle](https://megalinter.io/8.5.0/descriptors/java_checkstyle)                                |    4|     |                                                                             0|       0|4.64s       |
|✅ JSON      |[jsonlint](https://megalinter.io/8.5.0/descriptors/json_jsonlint)                                    |    3|     |                                                                             0|       0|0.14s       |
|✅ JSON      |[prettier](https://megalinter.io/8.5.0/descriptors/json_prettier)                                    |    3|     |                                                                             0|       0|0.34s       |
|✅ JSON      |[v8r](https://megalinter.io/8.5.0/descriptors/json_v8r)                                              |    3|     |                                                                             0|       0|3.32s       |
|✅ MARKDOWN  |[markdownlint](https://megalinter.io/8.5.0/descriptors/markdown_markdownlint)                        |    2|     |                                                                             0|       0|0.55s       |
|✅ MARKDOWN  |[markdown-table-formatter](https://megalinter.io/8.5.0/descriptors/markdown_markdown_table_formatter)|    2|     |                                                                             0|       0|0.23s       |
|✅ REPOSITORY|[checkov](https://megalinter.io/8.5.0/descriptors/repository_checkov)                                |yes  |     |no                                                                            |no      |18.71s      |
|✅ REPOSITORY|[dustilock](https://megalinter.io/8.5.0/descriptors/repository_dustilock)                            |yes  |     |no                                                                            |no      |0.01s       |
|✅ REPOSITORY|[gitleaks](https://megalinter.io/8.5.0/descriptors/repository_gitleaks)                              |yes  |     |no                                                                            |no      |0.14s       |
|✅ REPOSITORY|[git_diff](https://megalinter.io/8.5.0/descriptors/repository_git_diff)                              |yes  |     |no                                                                            |no      |0.0s        |
|✅ REPOSITORY|[grype](https://megalinter.io/8.5.0/descriptors/repository_grype)                                    |yes  |     |no                                                                            |no      |30.67s      |
|✅ REPOSITORY|[kics](https://megalinter.io/8.5.0/descriptors/repository_kics)                                      |yes  |     |no                                                                            |no      |2.11s       |
|✅ REPOSITORY|[secretlint](https://megalinter.io/8.5.0/descriptors/repository_secretlint)                          |yes  |     |no                                                                            |no      |1.46s       |
|✅ REPOSITORY|[syft](https://megalinter.io/8.5.0/descriptors/repository_syft)                                      |yes  |     |no                                                                            |no      |2.14s       |
|✅ REPOSITORY|[trivy](https://megalinter.io/8.5.0/descriptors/repository_trivy)                                    |yes  |     |no                                                                            |no      |8.41s       |
|✅ REPOSITORY|[trivy-sbom](https://megalinter.io/8.5.0/descriptors/repository_trivy_sbom)                          |yes  |     |no                                                                            |no      |0.11s       |
|✅ REPOSITORY|[trufflehog](https://megalinter.io/8.5.0/descriptors/repository_trufflehog)                          |yes  |     |no                                                                            |no      |3.93s       |
|✅ XML       |[xmllint](https://megalinter.io/8.5.0/descriptors/xml_xmllint)                                       |    1|     |                                                                             0|       0|0.01s       |
|✅ YAML      |[prettier](https://megalinter.io/8.5.0/descriptors/yaml_prettier)                                    |    5|     |                                                                             0|       0|0.47s       |
|✅ YAML      |[v8r](https://megalinter.io/8.5.0/descriptors/yaml_v8r)                                              |    5|     |                                                                             0|       0|7.18s       |
|✅ YAML      |[yamllint](https://megalinter.io/8.5.0/descriptors/yaml_yamllint)                                    |    5|     |                                                                             0|       0|0.4s        |

See detailed report in [MegaLinter reports](https://github.com/miracum/kafka-fhir-serializer/actions/runs/14387358056)

You could have the same capabilities but better runtime performances if you use a MegaLinter flavor:
- [oxsecurity/megalinter/flavors/cupcake@v8.5.0](https://megalinter.io/8.5.0/flavors/cupcake/) (86 linters)


[![MegaLinter is graciously provided by OX Security](https://raw.githubusercontent.com/oxsecurity/megalinter/main/docs/assets/images/ox-banner.png)](https://www.ox.security/?ref=megalinter)

<!-- megalinter: github-comment-reporter workflow='Java CI' jobid='megalinter' -->

author_association: NONE