This is an automated email from the ASF dual-hosted git repository.

hgruszecki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 09cadc2e chore(ci): publish java-sdk to maven (#1885)
09cadc2e is described below

commit 09cadc2e4d29484d5fbd05ba071dba18b20feb07
Author: Nandakumar Vadivelu <[email protected]>
AuthorDate: Fri Jun 20 18:42:15 2025 +0530

    chore(ci): publish java-sdk to maven (#1885)
    
    Fixes #1884
---
 .github/workflows/publish_java_sdk.yml | 110 +++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)

diff --git a/.github/workflows/publish_java_sdk.yml 
b/.github/workflows/publish_java_sdk.yml
new file mode 100644
index 00000000..88551f25
--- /dev/null
+++ b/.github/workflows/publish_java_sdk.yml
@@ -0,0 +1,110 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: publish_java_sdk
+on:
+  push:
+    tags:
+      - "java-sdk-*"
+
+env:
+  GITHUB_TOKEN: ${{ github.token }}
+
+jobs:
+  validate:
+    if: startsWith(github.ref, 'refs/tags/java-sdk-')
+    runs-on: ubuntu-latest
+    steps:
+      - name: Extract tag name
+        id: extract
+        run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
+
+      - name: Validate tag format
+        run: |
+          TAG=${TAG}
+          if [[ ! "$TAG" =~ 
^java-sdk-([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
+            echo "Tag $TAG does not match strict semver format (java-sdk-X.Y.Z 
where 0 <= X,Y,Z <= 999)"
+            exit 1
+          fi
+          echo "Valid tag: $TAG"
+
+  tag:
+    needs: validate
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Extract tag name
+        id: extract_tag
+        run: |
+          tag=${GITHUB_REF#refs/tags/}
+          echo "tag_name=$tag" >> "$GITHUB_OUTPUT"
+          echo "::notice ::Tag that triggered the workflow: $tag"
+
+      - name: Extract java-sdk version from build.gradle.kts
+        id: extract_version
+        run: |
+          version=$(foreign/java/gradlew -p foreign/java/java-sdk properties 
-q | grep "version:" | cut -d: -f2 | tr -d ' ')
+          echo "java_sdk_version=$version" >> "$GITHUB_OUTPUT"
+          echo "::notice ::Version from gradle build file is $version"
+
+      - name: Check if version from build.gradle is the same as the tag
+        id: check_git_tag
+        run: |
+          if [[ "java-sdk-${{ steps.extract_version.outputs.java_sdk_version 
}}" == "${{ steps.extract_tag.outputs.tag_name }}" ]];
+          then
+            echo "::notice ::Tag ${{ steps.extract_tag.outputs.tag_name }} 
matches the version in build.gradle"
+            echo "tag_matches=true" >> "$GITHUB_OUTPUT"
+          else
+            echo "::warning ::Tag ${{ steps.extract_tag.outputs.tag_name }} 
does not matche the version from build.gradle"
+            echo "tag_matches=false" >> "$GITHUB_OUTPUT"
+          fi
+
+    outputs:
+      java_sdk_version: ${{ steps.extract_tag.outputs.tag_name }}
+      tag_created: ${{ steps.check_git_tag.outputs.tag_matches }}
+
+  publish:
+    name: Publish Java SDK to Maven Nexus
+    needs: tag
+    if: ${{ needs.tag.outputs.tag_created == 'true' }}
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout Code
+        uses: actions/checkout@v4
+
+      - name: Setup Java
+        uses: actions/setup-java@v4
+        with:
+          java-version: "17"
+          distribution: "temurin"
+
+      - name: Setup Gradle
+        uses: 
gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
+
+      - name: Build
+        run: foreign/java/dev-support/checks/build.sh build -x test -x 
checkstyleMain -x checkstyleTest
+
+      - name: Run tests
+        run: foreign/java/dev-support/checks/build.sh test
+
+      - name: Publish
+        # To publish we use secrets.NEXUS_USER and secrets.NEXUS_PASSWORD as 
credentials
+        run: foreign/java/dev-support/checks/build.sh build -x test -x 
checkstyleMain -x checkstyleTest publish

Reply via email to