From 54ed59e8a246036590661ff26be585d021da7cb1 Mon Sep 17 00:00:00 2001 From: jim Date: Fri, 16 Aug 2024 17:17:43 -0500 Subject: [PATCH] re-use JDK if gradle version is the same. --- .github/workflows/gradle.yml | 8 ++++++++ .github/workflows/release.yml | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f3c9f5c..1721d9d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,19 +18,27 @@ jobs: - uses: gradle/actions/wrapper-validation@v3 - uses: actions/setup-java@v4 + if: ${{ vars.GRADLE_JAVA_VERSION != vars.JAVA_VERSION }} with: distribution: ${{ vars.JAVA_VENDOR }} java-version: ${{ vars.GRADLE_JAVA_VERSION }} java-package: jre cache: 'gradle' + - run: printf "org.gradle.java.home=%s" "$JAVA_HOME" > gradle.properties + if: ${{ vars.GRADLE_JAVA_VERSION != vars.JAVA_VERSION }} - uses: actions/setup-java@v4 with: distribution: ${{ vars.JAVA_VENDOR }} java-version: ${{ vars.JAVA_VERSION }} check-latest: true + + - run: printf "org.gradle.java.home=%s" "$JAVA_HOME" > gradle.properties + if: ${{ vars.GRADLE_JAVA_VERSION == vars.JAVA_VERSION }} + - run: printf "\norg.gradle.java.installations.paths=%s" "$JAVA_HOME" >> gradle.properties + - run: java --version - name: Gradle Check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a27f3d0..1cd62f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,23 +18,33 @@ jobs: - uses: gradle/actions/wrapper-validation@v3 - uses: actions/setup-java@v4 + if: ${{ vars.GRADLE_JAVA_VERSION != vars.JAVA_VERSION }} with: distribution: ${{ vars.JAVA_VENDOR }} java-version: ${{ vars.GRADLE_JAVA_VERSION }} java-package: jre cache: 'gradle' + - run: printf "org.gradle.java.home=%s" "$JAVA_HOME" > gradle.properties + if: ${{ vars.GRADLE_JAVA_VERSION != vars.JAVA_VERSION }} - uses: actions/setup-java@v4 with: distribution: ${{ vars.JAVA_VENDOR }} java-version: ${{ vars.JAVA_VERSION }} check-latest: true + + - run: printf "org.gradle.java.home=%s" "$JAVA_HOME" > gradle.properties + if: ${{ vars.GRADLE_JAVA_VERSION == vars.JAVA_VERSION }} + - run: printf "\norg.gradle.java.installations.paths=%s" "$JAVA_HOME" >> gradle.properties + - run: java --version - name: Gradle Check run: ./gradlew check -PtargetJava=${{ vars.JAVA_VERSION }} --stacktrace + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Github Packages run: ./gradlew -PtargetJava=${{ vars.JAVA_VERSION }} :json-iterator:publish