From e0bdeddfb8699c1331a7ca4cbf043c2715f887d4 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Sat, 26 Sep 2026 09:53:14 +0300 Subject: [PATCH 1/2] Open a draft GitHub release after Maven Central The formatter's releases end in a draft GitHub release on the tag, and the plugin's had none: release.yml published to Maven Central only. A second job now runs once the central job is done. It takes the jar that went to Maven Central, handed over by the central job, and JReleaser opens a draft release on the tag with that jar, a checksum file, a signature for each and the commits since the previous tag, the shape of the formatter's releases. Publishing the draft stays a click on GitHub. JReleaser's release command deploys as well, so the github-release profile switches the Maven Central deployer off and the GitHub release on; without the profile the POM does what it did before. Both were rehearsed in dry-run on a copy with a local 2.27.0.2 tag: the Central deployment still verifies the POM and builds the bundle, and the release skips the deployer and would upload the jar, checksums_sha256.txt and their .asc files. --- .github/workflows/release.yml | 66 +++++++++++++++++++++++++++++++++-- pom.xml | 47 ++++++++++++++++++++++--- 2 files changed, 105 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5fbcf51..3410113 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,13 +3,14 @@ name: Release # Tags only, and the tag is the version: the POM keeps its development version, and this workflow sets # the tag's before it builds. A release is four numbers, X.Y.Z.N; anything else is refused. # -# Maven Central only. The build stages the plugin with its sources and javadoc in target/staging-deploy, +# Maven Central first. The build stages the plugin with its sources and javadoc in target/staging-deploy, # and JReleaser signs it with the release key, uploads it to the Central Portal and publishes it once the -# Portal has validated it. +# Portal has validated it. Then a draft GitHub release on the tag gets the same jar, signed, with a +# checksum file and the commits since the previous tag; publishing the draft is a click on GitHub. # # Needs four repository secrets: JRELEASER_MAVENCENTRAL_USERNAME and JRELEASER_MAVENCENTRAL_PASSWORD (the # Central Portal user token), JRELEASER_GPG_SECRET_KEY and JRELEASER_GPG_PASSPHRASE. `mise run gh:secrets` -# sets them from 1Password. +# sets them from 1Password. The draft release uses the workflow's own GITHUB_TOKEN. on: push: tags: @@ -59,6 +60,15 @@ jobs: JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} + # The jar Maven Central got, so that the GitHub release carries the same file instead of a rebuild. + - name: Hand the jar to the GitHub release job + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: plugin-jar + path: target/fmt-maven-plugin-${{ github.ref_name }}.jar + if-no-files-found: error + retention-days: 1 + - name: Keep JReleaser's log if: ${{ failure() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 @@ -67,3 +77,53 @@ jobs: path: target/jreleaser/trace.log if-no-files-found: ignore retention-days: 7 + + # A draft GitHub release on the tag, only once the plugin is on Maven Central. JReleaser signs the jar + # again with the release key and adds a checksum file and the commits since the previous tag. A re-run + # fails while a release for the tag exists. + github-release: + name: draft GitHub release + needs: central + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Install JDK 21 + uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 + with: + distribution: temurin + java-version: '21' + + # The central job has already refused anything but a clean X.Y.Z.N. + - name: Take the version from the tag + env: + VERSION: ${{ github.ref_name }} + run: >- + mvn --no-transfer-progress -B org.codehaus.mojo:versions-maven-plugin:2.22.0:set + -DnewVersion="$VERSION" -DgenerateBackupPoms=false + + - name: Collect the jar Maven Central got + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: plugin-jar + path: target + + - name: Open the draft release + run: mvn --no-transfer-progress -B -P github-release jreleaser:release + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} + + - name: Keep JReleaser's log + if: ${{ failure() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: jreleaser-log-github + path: target/jreleaser/trace.log + if-no-files-found: ignore + retention-days: 7 diff --git a/pom.xml b/pom.xml index ad145ff..e9967f3 100644 --- a/pom.xml +++ b/pom.xml @@ -78,6 +78,9 @@ 3.9.16 2.98.0.3 + + ALWAYS + false @@ -224,8 +227,9 @@ org.jreleaser @@ -236,12 +240,31 @@ MIT - + - false + ${jreleaser.github.release} + true + {{projectVersion}} + {{projectVersion}} + true + + ALWAYS + - {{commitShortHash}} {{commitTitle}} + + + + + ${project.build.directory}/${project.build.finalName}.jar + + + - ALWAYS + ${jreleaser.central.deploy} https://central.sonatype.com/api/v1/publisher dev.openjavaformat true @@ -298,4 +321,18 @@ + + + + + github-release + + NEVER + true + + + From 52da3d99bff5dc2350201250f90b8d3a573eb984 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Sat, 26 Sep 2026 09:56:48 +0300 Subject: [PATCH 2/2] Fix for codeql --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1ad3f79..31e276a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,4 @@ -name: "CodeQL" +name: "CodeQL analysis" on: push: