From fef75d0305d580e73ab4bef712e188152d8ad5d0 Mon Sep 17 00:00:00 2001 From: Luke Bemish Date: Wed, 22 May 2024 23:05:51 -0600 Subject: [PATCH] Run with java 21 --- .github/workflows/release.yml | 79 +++++++++++++++++++++++++++++++---- build.gradle | 16 ++++++- 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e48f3c..f6c1c83 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,9 @@ { "jobs": { "build": { + "outputs": { + "version": "${{ steps.record_version_capture_version.outputs.version }}" + }, "runs-on": "ubuntu-22.04", "permissions": { "contents": "write" @@ -8,7 +11,7 @@ "steps": [ { "name": "Setup Java", - "run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\"" + "run": "echo \"JAVA_HOME=$JAVA_HOME_21_X64\" >> \"$GITHUB_ENV\"" }, { "with": { @@ -17,21 +20,25 @@ "name": "Checkout", "uses": "actions/checkout@v4" }, + { + "name": "Validate Gradle Wrapper", + "uses": "gradle/actions/wrapper-validation@v3" + }, { "with": { - "path": "**/.gradle/loom-cache", + "path": "**/.gradle/loom-cache\n**/.gradle/quilt-loom-cache", "key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}", "restore-keys": "${{ runner.os }}-gradle-" }, "name": "Cache", - "uses": "actions/cache@v3" + "uses": "actions/cache@v4" }, { "with": { "gradle-home-cache-cleanup": true }, "name": "Setup Gradle", - "uses": "gradle/gradle-build-action@v2" + "uses": "gradle/actions/setup-gradle@v3" }, { "uses": "fregante/setup-git-user@v2" @@ -58,6 +65,67 @@ "GPG_KEY_PASSWORD": "${{ secrets.GPG_KEY_PASSWORD }}" } }, + { + "run": "git push && git push --tags" + }, + { + "name": "Record Version", + "run": "./gradlew recordVersion", + "id": "record_version", + "env": { + "CENTRAL_MAVEN_USER": "${{ secrets.CENTRAL_MAVEN_USER }}", + "CENTRAL_MAVEN_PASSWORD": "${{ secrets.CENTRAL_MAVEN_PASSWORD }}", + "GPG_SIGNING_KEY": "${{ secrets.GPG_SIGNING_KEY }}", + "GPG_KEY_PASSWORD": "${{ secrets.GPG_KEY_PASSWORD }}" + } + }, + { + "name": "Capture Recorded Version", + "run": "echo version=$(cat build/recordVersion.txt) >> \"$GITHUB_OUTPUT\"", + "id": "record_version_capture_version" + } + ] + }, + "publish": { + "needs": [ + "build" + ], + "runs-on": "ubuntu-22.04", + "steps": [ + { + "name": "Setup Java", + "run": "echo \"JAVA_HOME=$JAVA_HOME_21_X64\" >> \"$GITHUB_ENV\"" + }, + { + "with": { + "fetch-depth": "0", + "ref": "refs/tags/${{needs.build.outputs.version}}", + "persist-credentials": "false" + }, + "name": "Checkout", + "uses": "actions/checkout@v4" + }, + { + "name": "Validate Gradle Wrapper", + "uses": "gradle/actions/wrapper-validation@v3" + }, + { + "with": { + "path": "**/.gradle/loom-cache\n**/.gradle/quilt-loom-cache", + "key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}", + "restore-keys": "${{ runner.os }}-gradle-" + }, + "name": "Cache", + "uses": "actions/cache/restore@v4" + }, + { + "with": { + "cache-read-only": true, + "gradle-home-cache-cleanup": true + }, + "name": "Setup Gradle", + "uses": "gradle/actions/setup-gradle@v3" + }, { "name": "Publish", "run": "./gradlew publish closeAndReleaseSonatypeStagingRepository", @@ -68,9 +136,6 @@ "GPG_SIGNING_KEY": "${{ secrets.GPG_SIGNING_KEY }}", "GPG_KEY_PASSWORD": "${{ secrets.GPG_KEY_PASSWORD }}" } - }, - { - "run": "git push && git push --tags" } ] } diff --git a/build.gradle b/build.gradle index 3a05832..407a75b 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { id 'net.neoforged.gradle.userdev' version '7.0.120' id 'org.groovymc.modsdotgroovy' version '2.0.0-beta.24' id 'io.github.gradle-nexus.publish-plugin' version '2.0.0-rc-1' - id 'dev.lukebemish.managedversioning' version '1.2.7' + id 'dev.lukebemish.managedversioning' version '1.2.19' } group = 'org.groovymc.gml' @@ -31,16 +31,28 @@ managedVersioning { workflowDispatch.set(true) gradleJob { name.set 'build' + javaVersion.set '21' step { setupGitUser() } readOnly.set false gradlew 'Tag Release', 'tagRelease' gradlew 'Build', 'build' - gradlew 'Publish', 'publish', 'closeAndReleaseSonatypeStagingRepository' step { run.set 'git push && git push --tags' } + recordVersion 'Record Version', 'version' + secret('CENTRAL_MAVEN_USER') + secret('CENTRAL_MAVEN_PASSWORD') + secret('GPG_SIGNING_KEY') + secret('GPG_KEY_PASSWORD') + } + gradleJob { + name.set 'publish' + javaVersion.set '21' + needs.add('build') + tag.set('${{needs.build.outputs.version}}') + gradlew 'Publish', 'publish', 'closeAndReleaseSonatypeStagingRepository' secret('CENTRAL_MAVEN_USER') secret('CENTRAL_MAVEN_PASSWORD') secret('GPG_SIGNING_KEY')