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