From 419d06b4654436204e0b03c530d0fc3ff3ce38ac Mon Sep 17 00:00:00 2001 From: Sam Spycher Date: Wed, 7 May 2025 22:05:44 +0200 Subject: [PATCH 1/3] add snapshot release prevention to publish action Signed-off-by: Sam Spycher --- .github/workflows/publish.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c72c128..2c3a39b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,6 +7,7 @@ on: jobs: publish: + name: Publish to GitHub Packages runs-on: ubuntu-latest permissions: contents: read @@ -18,20 +19,25 @@ jobs: with: submodules: true # Ensure submodules are checked out if needed - - name: Set up JDK 8 + - name: Set up JDK 8 and Configure Maven Settings uses: actions/setup-java@v4 with: java-version: "8" distribution: "zulu" cache: maven + server-id: github # Id of the publication repository field in the pom.xml + settings-path: ${{ github.workspace }} # path for settings.xml with generated authentication info - - name: Configure Maven Settings for GitHub Packages - uses: actions/setup-java@v4 - with: - java-version: "8" # Repeat setup to ensure settings are configured - distribution: "zulu" - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file + - name: Verify Project Version is not a SNAPSHOT (on release event only) + if: github.event_name == 'release' # Only run this check for actual releases + run: | + PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + echo "Checking project version: $PROJECT_VERSION for release trigger." + if [[ "$PROJECT_VERSION" == *"-SNAPSHOT"* ]]; then + echo "Error: Attempting to deploy a SNAPSHOT version ($PROJECT_VERSION) on a release event. Aborting." + exit 1 + fi + echo "Project version $PROJECT_VERSION is a valid release version. Proceeding..." - name: Publish package run: mvn --batch-mode deploy -DskipTests=true From 8a6c6a2704136b3e5d824be538d2da0a223e5a27 Mon Sep 17 00:00:00 2001 From: Sam Spycher Date: Wed, 7 May 2025 22:37:54 +0200 Subject: [PATCH 2/3] Add java version info to build name Signed-off-by: Sam Spycher --- .github/workflows/mvn.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mvn.yml b/.github/workflows/mvn.yml index fdd9415..4f4e655 100644 --- a/.github/workflows/mvn.yml +++ b/.github/workflows/mvn.yml @@ -4,6 +4,7 @@ on: [push] jobs: build: + name: Java ${{ matrix.java }} runs-on: ubuntu-latest strategy: fail-fast: true From 0953cdd4dc265a953fcf9b42a3c6ffb2f8859d56 Mon Sep 17 00:00:00 2001 From: Sam Spycher Date: Thu, 8 May 2025 08:52:02 +0200 Subject: [PATCH 3/3] add debug output for publish.yml Signed-off-by: Sam Spycher --- .github/workflows/publish.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2c3a39b..49ee982 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,6 +28,13 @@ jobs: server-id: github # Id of the publication repository field in the pom.xml settings-path: ${{ github.workspace }} # path for settings.xml with generated authentication info + - name: Display generated Maven settings.xml for debugging + run: | + echo "Maven settings.xml:" + cat ${{ github.workspace }}/settings.xml || echo "settings.xml not found or empty." + echo "env:" + env + - name: Verify Project Version is not a SNAPSHOT (on release event only) if: github.event_name == 'release' # Only run this check for actual releases run: |