Skip to content

Commit f393bf6

Browse files
committed
fix: select JDK/build task from branch gradle.properties in CI
26.1 requires Java 25; Dev Builds previously always used the build.yml default of 21. Each branch now declares ci_java_version and ci_build_task.
1 parent 0ebf5cc commit f393bf6

3 files changed

Lines changed: 35 additions & 14 deletions

File tree

.github/workflows/build-branches.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,30 @@ jobs:
2828
with:
2929
ref: ${{ matrix.branch }}
3030

31+
- name: Resolve CI Java / build task
32+
id: ci_meta
33+
run: |
34+
# Prefer values from the checked-out branch; fall back to matrix / defaults.
35+
JAVA=$(grep -E '^[[:space:]]*ci_java_version[[:space:]]*=' gradle.properties | tail -1 | cut -d= -f2- | tr -d ' \r' || true)
36+
TASK=$(grep -E '^[[:space:]]*ci_build_task[[:space:]]*=' gradle.properties | tail -1 | cut -d= -f2- | tr -d ' \r' || true)
37+
if [ -z "$JAVA" ]; then JAVA='${{ matrix.java }}'; fi
38+
if [ -z "$TASK" ]; then TASK='${{ matrix.build_task }}'; fi
39+
echo "java=${JAVA:-21}" >> "$GITHUB_OUTPUT"
40+
echo "task=${TASK:-remapJar}" >> "$GITHUB_OUTPUT"
41+
echo "Branch ${{ matrix.branch }} -> java=${JAVA:-21} task=${TASK:-remapJar}"
42+
java -version || true
43+
3144
- name: Set up JDK
3245
uses: actions/setup-java@v4
3346
with:
34-
java-version: ${{ matrix.java }}
47+
java-version: ${{ steps.ci_meta.outputs.java }}
3548
distribution: 'temurin'
3649

50+
- name: Verify Java
51+
run: |
52+
echo "JAVA_HOME=$JAVA_HOME"
53+
java -version
54+
3755
- name: Cache gradle files
3856
uses: actions/cache@v4
3957
with:
@@ -50,7 +68,7 @@ jobs:
5068
run: chmod +x gradlew
5169

5270
- name: Build with Gradle
53-
run: ./gradlew ${{ matrix.build_task }} --no-daemon
71+
run: ./gradlew ${{ steps.ci_meta.outputs.task }} --no-daemon
5472
env:
5573
BUILD_TAG: ${{ inputs.tag }}
5674
BUILD_ID: ${{ github.run_number }}

.github/workflows/build.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ on:
1616
required: false
1717
description: Git ref/branch to checkout; empty uses the triggering ref
1818
default: ''
19-
java_version:
20-
type: string
21-
required: false
22-
description: JDK major version
23-
default: '21'
24-
build_task:
25-
type: string
26-
required: false
27-
description: Gradle task to run
28-
default: 'remapJar'
2919
artifact_name:
3020
type: string
3121
required: false
@@ -47,10 +37,19 @@ jobs:
4737
with:
4838
ref: ${{ inputs.ref }}
4939

40+
- name: Resolve CI Java / build task
41+
id: ci_meta
42+
run: |
43+
JAVA=$(grep -E '^[[:space:]]*ci_java_version[[:space:]]*=' gradle.properties | tail -1 | cut -d= -f2- | tr -d ' \r' || true)
44+
TASK=$(grep -E '^[[:space:]]*ci_build_task[[:space:]]*=' gradle.properties | tail -1 | cut -d= -f2- | tr -d ' \r' || true)
45+
echo "java=${JAVA:-21}" >> "$GITHUB_OUTPUT"
46+
echo "task=${TASK:-remapJar}" >> "$GITHUB_OUTPUT"
47+
echo "Resolved ci_java_version=${JAVA:-21} ci_build_task=${TASK:-remapJar}"
48+
5049
- name: Set up JDK
5150
uses: actions/setup-java@v4
5251
with:
53-
java-version: ${{ inputs.java_version }}
52+
java-version: ${{ steps.ci_meta.outputs.java }}
5453
distribution: 'temurin'
5554

5655
- name: Cache gradle files
@@ -68,7 +67,7 @@ jobs:
6867
run: chmod +x gradlew
6968

7069
- name: Build with Gradle
71-
run: ./gradlew ${{ inputs.build_task }} --no-daemon
70+
run: ./gradlew ${{ steps.ci_meta.outputs.task }} --no-daemon
7271
env:
7372
BUILD_TAG: ${{ inputs.tag }}
7473
BUILD_ID: ${{ github.run_number }}

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ fabric_api_version = 0.91.6+1.20.2
1616
neoforge_version = 20.2.93
1717

1818
incremental_storage_lib_version=1.3.0+build.26030517.05
19+
20+
# CI build settings (read by GitHub Actions after checkout)
21+
ci_java_version = 21
22+
ci_build_task = remapJar

0 commit comments

Comments
 (0)