This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git
The following commit(s) were added to refs/heads/main by this push:
new acdfb18 chore: centralize Java version configuration in composite
action (#38)
acdfb18 is described below
commit acdfb188985b7fcce5a840030868cb9b03077906
Author: Aditya Parikh <[email protected]>
AuthorDate: Tue Feb 3 17:03:49 2026 -0500
chore: centralize Java version configuration in composite action (#38)
Create a reusable composite action (.github/actions/setup-java) to
centralize Java version configuration across all workflows. This
eliminates duplication and makes future Java version updates
single-point changes.
Changes:
- Add .github/actions/setup-java/action.yml with Java 25 + Temurin
- Update build-and-publish.yml to use composite action
- Update release-publish.yml to use composite action
- Update nightly-build.yml to use composite action
- Update atr-release.yml to use composite action
- Update atr-release-test.yml to use composite action
- Remove redundant env variables (JAVA_VERSION, JAVA_DISTRIBUTION)
- Remove duplicate chmod +x gradlew steps (now in composite action)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <[email protected]>
---
.github/actions/setup-java/action.yml | 50 +++++++++++++++++++++++++++++++++
.github/workflows/atr-release-test.yml | 15 +++-------
.github/workflows/atr-release.yml | 15 +++-------
.github/workflows/build-and-publish.yml | 41 ++++++---------------------
.github/workflows/nightly-build.yml | 20 +++----------
.github/workflows/release-publish.yml | 20 +++----------
6 files changed, 74 insertions(+), 87 deletions(-)
diff --git a/.github/actions/setup-java/action.yml
b/.github/actions/setup-java/action.yml
new file mode 100644
index 0000000..0c7cce0
--- /dev/null
+++ b/.github/actions/setup-java/action.yml
@@ -0,0 +1,50 @@
+# 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.
+
+# Composite action for setting up Java environment
+# Centralizes Java version configuration to avoid duplication across workflows
+#
+# Usage in workflows:
+# - uses: ./.github/actions/setup-java
+#
+# To update Java version, change JAVA_VERSION below.
+# All workflows using this action will automatically use the new version.
+
+name: 'Setup Java'
+description: 'Set up Java environment with Gradle caching'
+
+outputs:
+ java-version:
+ description: 'The Java version that was set up'
+ value: ${{ steps.setup.outputs.version }}
+
+runs:
+ using: 'composite'
+ steps:
+ - name: Set up JDK
+ id: setup
+ uses: actions/setup-java@v4
+ with:
+ # ============================================
+ # CENTRALIZED JAVA VERSION CONFIGURATION
+ # Change this value to update Java across all workflows
+ # ============================================
+ java-version: '25'
+ distribution: 'temurin'
+ cache: 'gradle'
+
+ - name: Grant execute permission for gradlew
+ shell: bash
+ run: chmod +x gradlew
diff --git a/.github/workflows/atr-release-test.yml
b/.github/workflows/atr-release-test.yml
index 5667d58..cfe4882 100644
--- a/.github/workflows/atr-release-test.yml
+++ b/.github/workflows/atr-release-test.yml
@@ -95,8 +95,6 @@ permissions:
packages: write # May be needed for publishing artifacts
env:
- JAVA_VERSION: '25'
- JAVA_DISTRIBUTION: 'temurin'
ATR_PROJECT_NAME: 'solr-mcp' # Project identifier in ATR platform
jobs:
@@ -128,15 +126,10 @@ jobs:
echo "Test tag already exists: ${TEST_TAG}"
fi
- - name: Set up JDK ${{ env.JAVA_VERSION }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ env.JAVA_VERSION }}
- distribution: ${{ env.JAVA_DISTRIBUTION }}
- cache: 'gradle'
-
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
+ # Set up Java environment using centralized configuration
+ # See .github/actions/setup-java/action.yml to update Java version
+ - name: Set up Java
+ uses: ./.github/actions/setup-java
- name: Build project
run: |
diff --git a/.github/workflows/atr-release.yml
b/.github/workflows/atr-release.yml
index a35ba29..bbb2b86 100644
--- a/.github/workflows/atr-release.yml
+++ b/.github/workflows/atr-release.yml
@@ -137,8 +137,6 @@ permissions:
packages: write # May be needed for publishing artifacts
env:
- JAVA_VERSION: '25'
- JAVA_DISTRIBUTION: 'temurin'
ATR_PROJECT_NAME: 'solr-mcp' # Project identifier in ATR platform
jobs:
@@ -167,15 +165,10 @@ jobs:
fi
echo "✓ Release tag verified"
- - name: Set up JDK ${{ env.JAVA_VERSION }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ env.JAVA_VERSION }}
- distribution: ${{ env.JAVA_DISTRIBUTION }}
- cache: 'gradle'
-
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
+ # Set up Java environment using centralized configuration
+ # See .github/actions/setup-java/action.yml to update Java version
+ - name: Set up Java
+ uses: ./.github/actions/setup-java
- name: Build project
run: |
diff --git a/.github/workflows/build-and-publish.yml
b/.github/workflows/build-and-publish.yml
index 8e7038d..eacba70 100644
--- a/.github/workflows/build-and-publish.yml
+++ b/.github/workflows/build-and-publish.yml
@@ -109,13 +109,6 @@ on:
- main # Build + test validation for incoming changes
workflow_dispatch: # Manual runs for maintainers
-# Global environment used by all jobs in this workflow
-# - JAVA_VERSION: JDK version to install for Gradle builds
-# - JAVA_DISTRIBUTION: Vendor/distribution of the JDK (Temurin is Eclipse
Adoptium)
-env:
- JAVA_VERSION: '25'
- JAVA_DISTRIBUTION: 'temurin'
-
jobs:
#
============================================================================
# Job 1: Build JAR
@@ -138,20 +131,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- # Set up Java Development Kit
- # Uses Temurin (Eclipse Adoptium) distribution of OpenJDK 25
- # Gradle cache is enabled to speed up subsequent builds
- - name: Set up JDK ${{ env.JAVA_VERSION }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ env.JAVA_VERSION }}
- distribution: ${{ env.JAVA_DISTRIBUTION }}
- cache: 'gradle'
-
- # Make the Gradle wrapper executable
- # Required on Unix-based systems (Linux, macOS)
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
+ # Set up Java environment using centralized configuration
+ # See .github/actions/setup-java/action.yml to update Java version
+ - name: Set up Java
+ uses: ./.github/actions/setup-java
# Build the project with Gradle
# This runs: compilation, tests, spotless formatting, error-prone
checks,
@@ -228,18 +211,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- # Set up Java for running Jib
- # Jib doesn't require Docker but needs Java to run
- - name: Set up JDK ${{ env.JAVA_VERSION }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ env.JAVA_VERSION }}
- distribution: ${{ env.JAVA_DISTRIBUTION }}
- cache: 'gradle'
-
- # Make Gradle wrapper executable
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
+ # Set up Java environment using centralized configuration
+ # See .github/actions/setup-java/action.yml to update Java version
+ - name: Set up Java
+ uses: ./.github/actions/setup-java
# Extract version and determine image tags
# Outputs:
diff --git a/.github/workflows/nightly-build.yml
b/.github/workflows/nightly-build.yml
index 2edee1f..d2121e1 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -91,13 +91,6 @@ on:
type: boolean
default: false
-# Environment variables used by steps below
-# - JAVA_VERSION: selects the JDK version used to build and run Gradle
-# - JAVA_DISTRIBUTION: selects the vendor (Temurin = Eclipse Adoptium)
-env:
- JAVA_VERSION: '25'
- JAVA_DISTRIBUTION: 'temurin'
-
jobs:
nightly-build:
name: Nightly Build and Publish
@@ -114,15 +107,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- - name: Set up JDK ${{ env.JAVA_VERSION }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ env.JAVA_VERSION }}
- distribution: ${{ env.JAVA_DISTRIBUTION }}
- cache: 'gradle'
-
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
+ # Set up Java environment using centralized configuration
+ # See .github/actions/setup-java/action.yml to update Java version
+ - name: Set up Java
+ uses: ./.github/actions/setup-java
- name: Generate nightly version
id: version
diff --git a/.github/workflows/release-publish.yml
b/.github/workflows/release-publish.yml
index 61b51e0..9cc7863 100644
--- a/.github/workflows/release-publish.yml
+++ b/.github/workflows/release-publish.yml
@@ -125,13 +125,6 @@ on:
type: boolean
default: false
-# Global environment settings used across jobs
-# - JAVA_VERSION: version of JDK used to build the project
-# - JAVA_DISTRIBUTION: OpenJDK distribution to install via actions/setup-java
-env:
- JAVA_VERSION: '25'
- JAVA_DISTRIBUTION: 'temurin'
-
jobs:
validate-release:
name: Validate Release Prerequisites
@@ -187,15 +180,10 @@ jobs:
with:
ref: "v${{ inputs.release_version }}-${{ inputs.release_candidate }}"
- - name: Set up JDK ${{ env.JAVA_VERSION }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ env.JAVA_VERSION }}
- distribution: ${{ env.JAVA_DISTRIBUTION }}
- cache: 'gradle'
-
- - name: Grant execute permission for gradlew
- run: chmod +x gradlew
+ # Set up Java environment using centralized configuration
+ # See .github/actions/setup-java/action.yml to update Java version
+ - name: Set up Java
+ uses: ./.github/actions/setup-java
- name: Update version in build.gradle.kts
run: |