Dynamically use java 25 for v2 buildscripts and 21 for v1

This commit is contained in:
Raven Szewczyk 2025-11-18 19:32:52 +00:00
parent 8381e6ce69
commit 7488a8b341
4 changed files with 72 additions and 19 deletions

View File

@ -31,27 +31,39 @@ jobs:
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install -y mesa-utils xvfb x11-xserver-utils sudo apt-get install -y mesa-utils xvfb x11-xserver-utils
- name: Checkout mod repo - name: Checkout mod repo
uses: actions/checkout@v4 uses: actions/checkout@v5
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Checkout workflows repo - name: Checkout workflows repo
uses: actions/checkout@v4 uses: actions/checkout@v5
with: with:
repository: GTNewHorizons/GTNH-Actions-Workflows repository: GTNewHorizons/GTNH-Actions-Workflows
path: .gtnh-workflows path: .gtnh-workflows
fetch-depth: 0 fetch-depth: 0
- name: Determine JDK versions
id: list-jdk-versions
shell: bash
run: |
(
echo 'java-versions<<EOF'
echo 8
echo 17
echo 21
if [[ -f gradle/gradle-daemon-jvm.properties ]]; then
yq -pprops -oprops '.toolchainVersion' gradle/gradle-daemon-jvm.properties
fi
echo EOF
) | tee -a "${GITHUB_OUTPUT}"
- name: Set up JDK versions - name: Set up JDK versions
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
java-version: | java-version: ${{ steps.list-jdk-versions.outputs.java-versions }}
8
17
21
distribution: 'zulu' distribution: 'zulu'
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 uses: gradle/actions/setup-gradle@v5
with: with:
build-scan-publish: true build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
@ -68,7 +80,7 @@ jobs:
run: ./gradlew --build-cache --info --stacktrace assemble run: ./gradlew --build-cache --info --stacktrace assemble
- name: Attach compilation artifacts - name: Attach compilation artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
with: with:
name: ${{ github.repository_id }}-build-libs name: ${{ github.repository_id }}-build-libs
path: build/libs/ path: build/libs/
@ -80,7 +92,7 @@ jobs:
- name: Attach gradle reports - name: Attach gradle reports
if: failure() && steps.build_mod.conclusion == 'failure' if: failure() && steps.build_mod.conclusion == 'failure'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v5
continue-on-error: true continue-on-error: true
with: with:
name: ${{ github.repository_id }}-reports name: ${{ github.repository_id }}-reports

View File

@ -32,21 +32,33 @@ jobs:
MAVEN_PUBLISHING_URL: ${{ vars.MAVEN_PUBLISHING_URL || 'https://nexus.gtnewhorizons.com/repository/releases/' }} MAVEN_PUBLISHING_URL: ${{ vars.MAVEN_PUBLISHING_URL || 'https://nexus.gtnewhorizons.com/repository/releases/' }}
steps: steps:
- name: Checkout mod repo - name: Checkout mod repo
uses: actions/checkout@v4 uses: actions/checkout@v5
with: with:
fetch-depth: 32 fetch-depth: 32
- name: Determine JDK versions
id: list-jdk-versions
shell: bash
run: |
(
echo 'java-versions<<EOF'
echo 8
echo 17
echo 21
if [[ -f gradle/gradle-daemon-jvm.properties ]]; then
yq -pprops -oprops '.toolchainVersion' gradle/gradle-daemon-jvm.properties
fi
echo EOF
) | tee -a "${GITHUB_OUTPUT}"
- name: Set up JDK versions - name: Set up JDK versions
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
java-version: | java-version: ${{ steps.list-jdk-versions.outputs.java-versions }}
8
17
21
distribution: 'zulu' distribution: 'zulu'
- name: Setup Gradle - name: Setup Gradle
uses: gradle/actions/setup-gradle@v4 uses: gradle/actions/setup-gradle@v5
with: with:
build-scan-publish: true build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
@ -76,7 +88,7 @@ jobs:
if [[ "$SNAPSHOT" == "true" ]]; then if [[ "$SNAPSHOT" == "true" ]]; then
PRERELEASE="--prerelease" PRERELEASE="--prerelease"
fi fi
CHANGELOG_OVERRIDE=".changelogs/${RELEASE_VERSION}.md" CHANGELOG_OVERRIDE=".changelogs/${RELEASE_VERSION}.md"
if [[ -f "$CHANGELOG_OVERRIDE" ]]; then if [[ -f "$CHANGELOG_OVERRIDE" ]]; then
echo "Using changelog override: $CHANGELOG_OVERRIDE" echo "Using changelog override: $CHANGELOG_OVERRIDE"
export "CHANGELOG_FILE=$CHANGELOG_OVERRIDE" export "CHANGELOG_FILE=$CHANGELOG_OVERRIDE"
@ -89,7 +101,7 @@ jobs:
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \ "/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
-f tag_name="${RELEASE_VERSION}" \ -f tag_name="${RELEASE_VERSION}" \
--jq ".body" > "${CHANGELOG_FILE}" --jq ".body" > "${CHANGELOG_FILE}"
fi fi
cat "${CHANGELOG_FILE}" cat "${CHANGELOG_FILE}"
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" $PRERELEASE ./build/libs/*.jar gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" $PRERELEASE ./build/libs/*.jar
shell: bash shell: bash

View File

@ -0,0 +1,16 @@
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
# with:
# timeout: 150
# workspace: setupDecompWorkspace
# client-only: false

View File

@ -0,0 +1,13 @@
name: Release tagged build
on:
push:
tags: [ '*' ]
permissions:
contents: write
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit