From 23adf3b1a44d3cd526f627446aba301028365f52 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 10:43:25 +0200 Subject: [PATCH 01/17] upload build artifacts --- .github/workflows/gradle.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 753ffaa..dd647d9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -43,6 +43,12 @@ jobs: - name: Build with Gradle Wrapper run: ./gradlew build --parallel + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: Package + path: build/libs + - name: Summarize tests results uses: jeantessier/test-summary-action@v1 if: ${{ always() }} From acc9f1fb1b1dba55e2947f6a4b7d6cd5192e669c Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 10:51:08 +0200 Subject: [PATCH 02/17] make workflow run on 2.0 branch --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index dd647d9..ed73007 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,9 +9,9 @@ name: Java CI with Gradle on: push: - branches: [ "master" ] + branches: [ "master", "v2.0.0" ] pull_request: - branches: [ "master" ] + branches: [ "master", "v2.0.0" ] jobs: build: From b3bccb4d1f497454ff73a436883311aed04155a2 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 11:09:39 +0200 Subject: [PATCH 03/17] move dependency submission out of build --- .github/workflows/dependency.yml | 39 ++++++++++++++++++++++++++++++++ .github/workflows/gradle.yml | 25 +------------------- 2 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/dependency.yml diff --git a/.github/workflows/dependency.yml b/.github/workflows/dependency.yml new file mode 100644 index 0000000..f2fb42a --- /dev/null +++ b/.github/workflows/dependency.yml @@ -0,0 +1,39 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "master", "v2.0.0" ] + +jobs: + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDKs + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: | + 16 + 17 + 20 + 21 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ed73007..23d91ab 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -62,27 +62,4 @@ jobs: # gradle-version: '8.9' # # - name: Build with Gradle 8.9 - # run: gradle build - - dependency-submission: - - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: | - 16 - 17 - 20 - 21 - - # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. - # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + # run: gradle build \ No newline at end of file From 4f8d4d6b77495faca3de971ba0de212ef42514d1 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 11:18:30 +0200 Subject: [PATCH 04/17] remove unused note --- .github/workflows/gradle.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 23d91ab..71f8511 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -52,14 +52,3 @@ jobs: - name: Summarize tests results uses: jeantessier/test-summary-action@v1 if: ${{ always() }} - - # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). - # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. - # - # - name: Setup Gradle - # uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - # with: - # gradle-version: '8.9' - # - # - name: Build with Gradle 8.9 - # run: gradle build \ No newline at end of file From 6b470aa63511f47147b9e22ef9e48cca8275718e Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 11:22:56 +0200 Subject: [PATCH 05/17] upload build per individual files --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 71f8511..973acfd 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -47,7 +47,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: Package - path: build/libs + path: build/libs/* - name: Summarize tests results uses: jeantessier/test-summary-action@v1 From b53b462151ca6d457753ce1437faabc20223f50b Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 11:44:16 +0200 Subject: [PATCH 06/17] add temporary pull request for test of dependency task --- .github/workflows/dependency.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependency.yml b/.github/workflows/dependency.yml index f2fb42a..3d1bf39 100644 --- a/.github/workflows/dependency.yml +++ b/.github/workflows/dependency.yml @@ -10,6 +10,8 @@ name: Java CI with Gradle on: push: branches: [ "master", "v2.0.0" ] + pull_request: + branches: [ "master", "v2.0.0" ] jobs: dependency-submission: From 4ab55b70b40261ae3434a697c8dd13132c466c1c Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 11:45:16 +0200 Subject: [PATCH 07/17] avoid concurent action --- .github/workflows/dependency.yml | 4 ++++ .github/workflows/gradle.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/dependency.yml b/.github/workflows/dependency.yml index 3d1bf39..e45ecf6 100644 --- a/.github/workflows/dependency.yml +++ b/.github/workflows/dependency.yml @@ -13,6 +13,10 @@ on: pull_request: branches: [ "master", "v2.0.0" ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: dependency-submission: diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 973acfd..10e258a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,6 +13,10 @@ on: pull_request: branches: [ "master", "v2.0.0" ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: From a44827c2a62438ff445fb75cea3230112e6d3529 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:06:23 +0200 Subject: [PATCH 08/17] should upload the jars individually now --- .github/workflows/gradle.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 10e258a..8d532e9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -47,12 +47,31 @@ jobs: - name: Build with Gradle Wrapper run: ./gradlew build --parallel - - name: Upload build artifacts + # Get the names of the online and offline jars + - name: Get file name for online JAR of CustomAnvil # grep -v "offline" to exclude offline jar + run: | + ONLINE_JAR_NAME=$(ls build/libs/CustomAnvil-*.jar | grep -v "offline") + echo "online_jar_name=${ONLINE_JAR_NAME}" >> $GITHUB_ENV + + - name: Get file name for offline JAR of CustomAnvil + run: | + OFFLINE_JAR_NAME=$(ls build/libs/CustomAnvil-*-offline.jar) + echo "offline_jar_name=${OFFLINE_JAR_NAME}" >> $GITHUB_ENV + + # upload the named jars + - name: Upload online JAR artifact uses: actions/upload-artifact@v4 with: - name: Package - path: build/libs/* + name: ${{ env.online_jar_name }} + path: build/libs/${{ env.online_jar_name }} + - name: Upload offline JAR file + uses: actions/upload-artifact@v4 + with: + name: ${{ env.online_jar_name }} + path: build/libs/${{ env.online_jar_name }} + + # Finally, upload test result - name: Summarize tests results uses: jeantessier/test-summary-action@v1 if: ${{ always() }} From 1cd2d278149ccadca4f44761866438a578304eea Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:11:20 +0200 Subject: [PATCH 09/17] move back dependency workflow --- .github/workflows/dependency.yml | 45 -------------------------------- .github/workflows/gradle.yml | 14 +++++++++- 2 files changed, 13 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/dependency.yml diff --git a/.github/workflows/dependency.yml b/.github/workflows/dependency.yml deleted file mode 100644 index e45ecf6..0000000 --- a/.github/workflows/dependency.yml +++ /dev/null @@ -1,45 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ "master", "v2.0.0" ] - pull_request: - branches: [ "master", "v2.0.0" ] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - dependency-submission: - - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: | - 16 - 17 - 20 - 21 - - - name: Make gradlew executable - run: chmod +x ./gradlew - - # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. - # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 8d532e9..44c0fc7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -14,7 +14,7 @@ on: branches: [ "master", "v2.0.0" ] concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.ref }} cancel-in-progress: true jobs: @@ -75,3 +75,15 @@ jobs: - name: Summarize tests results uses: jeantessier/test-summary-action@v1 if: ${{ always() }} + + dependency-submission: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 From b0d3f25347c8e092cf7bd10292dadd981685549f Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:33:29 +0200 Subject: [PATCH 10/17] move dependency submission & correct upload of jars --- .github/workflows/gradle.yml | 100 ++++++++++++++++------------------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 44c0fc7..902cc2b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -25,65 +25,57 @@ jobs: contents: read steps: - - uses: actions/checkout@v4 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - java-version: | + - uses: actions/checkout@v4 + - name: Set up JDKs + uses: actions/setup-java@v4 + with: + java-version: | 16 17 20 21 - distribution: 'temurin' - cache: 'gradle' + distribution: 'temurin' + cache: 'gradle' - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 - - name: Make gradlew executable - run: chmod +x ./gradlew - - name: Build with Gradle Wrapper - run: ./gradlew build --parallel + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Build with Gradle Wrapper + run: ./gradlew build --parallel - # Get the names of the online and offline jars - - name: Get file name for online JAR of CustomAnvil # grep -v "offline" to exclude offline jar - run: | - ONLINE_JAR_NAME=$(ls build/libs/CustomAnvil-*.jar | grep -v "offline") - echo "online_jar_name=${ONLINE_JAR_NAME}" >> $GITHUB_ENV - - - name: Get file name for offline JAR of CustomAnvil - run: | - OFFLINE_JAR_NAME=$(ls build/libs/CustomAnvil-*-offline.jar) - echo "offline_jar_name=${OFFLINE_JAR_NAME}" >> $GITHUB_ENV - - # upload the named jars - - name: Upload online JAR artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ env.online_jar_name }} - path: build/libs/${{ env.online_jar_name }} - - - name: Upload offline JAR file - uses: actions/upload-artifact@v4 - with: - name: ${{ env.online_jar_name }} - path: build/libs/${{ env.online_jar_name }} - - # Finally, upload test result - - name: Summarize tests results - uses: jeantessier/test-summary-action@v1 - if: ${{ always() }} - - dependency-submission: - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. - # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + # only submit dependency on push - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + uses: gradle/actions/dependency-submission@v4 + #if: ${{ github.event_name == 'push' && success() }} #temporarly disabled for test + continue-on-error: true + + # Get the names of the online and offline jars + # grep -v "offline" to exclude offline jar as the regex would catch it otherwise + - name: Get file name for jars + run: | + ONLINE_JAR_PATH=$(ls build/libs/CustomAnvil-*.jar | grep -v "offline") + OFFLINE_JAR_PATH=$(ls build/libs/CustomAnvil-*-offline.jar) + + echo "online_jar_name=$(basename $ONLINE_JAR_PATH)" >> $GITHUB_ENV + echo "offline_jar_name=$(basename $OFFLINE_JAR_PATH)" >> $GITHUB_ENV + + # upload the named jars + - name: Upload online JAR artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.online_jar_name }} + path: build/libs/${{ env.online_jar_name }} + + - name: Upload offline JAR file + uses: actions/upload-artifact@v4 + with: + name: ${{ env.online_jar_name }} + path: build/libs/${{ env.online_jar_name }} + + - name: Summarize tests results + uses: jeantessier/test-summary-action@v1 + if: ${{ always() }} \ No newline at end of file From 18b3a0421b6a12a79dd349e49e9c783435254896 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:39:33 +0200 Subject: [PATCH 11/17] oops --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 902cc2b..f339f76 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -73,8 +73,8 @@ jobs: - name: Upload offline JAR file uses: actions/upload-artifact@v4 with: - name: ${{ env.online_jar_name }} - path: build/libs/${{ env.online_jar_name }} + name: ${{ env.offline_jar_name }} + path: build/libs/${{ env.offline_jar_name }} - name: Summarize tests results uses: jeantessier/test-summary-action@v1 From 3e7b44102c3d96bdc164fbf0e51365fbb697840a Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:45:24 +0200 Subject: [PATCH 12/17] add write permission because of dependency submission --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f339f76..744f80d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest permissions: - contents: read + contents: write steps: - uses: actions/checkout@v4 From d4bb82dc87b07bd738b2a022cb0aee8c4a5459f1 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 13:35:17 +0200 Subject: [PATCH 13/17] small commit hash as a gradlew environment variable --- .github/workflows/gradle.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 744f80d..b54bed9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -44,8 +44,14 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew + + - name: Get small commit hash + run: echo "small_commit_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV + - name: Build with Gradle Wrapper run: ./gradlew build --parallel + env: + SMALL_COMMIT_HASH: ${{ env.small_commit_hash }} # only submit dependency on push - name: Generate and submit dependency graph From 36a2bd23a6d7fa9627073e2fc22ebeee2a423411 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 13:47:20 +0200 Subject: [PATCH 14/17] use small hash for effective plugin version --- build.gradle.kts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 63d5673..e829958 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,6 +18,9 @@ plugins { group = "xyz.alexcrea" version = "1.11.3" +val effectiveVersion = "$version" + + {(if(project.hasProperty("smallCommitHash")) "-${project.property("smallCommitHash")}" else "")} + repositories { // EcoEnchants maven(url = "https://repo.auxilor.io/repository/maven-public/") @@ -135,7 +138,8 @@ val fatJar = tasks.register("fatJar") { manifest { attributes.apply { put("Main-Class", "io.delilaheve.CustomAnvil") } } - archiveFileName.set("${rootProject.name}-${project.version}.jar") + + archiveFileName.set("${rootProject.name}-${effectiveVersion}.jar") exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA") duplicatesStrategy = DuplicatesStrategy.WARN from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) @@ -158,7 +162,7 @@ tasks { // Replace version and example fields in plugin.yml filesMatching("plugin.yml") { expand( - "version" to project.version, + "version" to effectiveVersion, "libraries" to " \"org.jetbrains.kotlin:kotlin-stdlib:2.1.0\" " ) } @@ -183,7 +187,7 @@ tasks { filesMatching("plugin.yml") { expand( - "version" to "${project.version}-offline", + "version" to "$effectiveVersion-offline", "libraries" to "" ) } From 71e0761476a0238a9d54cb4aff6c7c14f41db8d6 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 14:05:14 +0200 Subject: [PATCH 15/17] fix not getting environment variable --- .github/workflows/gradle.yml | 1 - build.gradle.kts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b54bed9..48f4c21 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,7 +19,6 @@ concurrency: jobs: build: - runs-on: ubuntu-latest permissions: contents: write diff --git a/build.gradle.kts b/build.gradle.kts index e829958..a7d3617 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ group = "xyz.alexcrea" version = "1.11.3" val effectiveVersion = "$version" + - {(if(project.hasProperty("smallCommitHash")) "-${project.property("smallCommitHash")}" else "")} + { (if (System.getenv("SMALL_COMMIT_HASH") != null) "-${System.getenv("SMALL_COMMIT_HASH")!!}" else "") } repositories { // EcoEnchants @@ -118,7 +118,8 @@ allprojects { // Set target version tasks.withType().configureEach { - sourceCompatibility = "16" // We aim for java 16 for minecraft 1.16.5. even if it not really suported by custom anvil. + sourceCompatibility = + "16" // We aim for java 16 for minecraft 1.16.5. even if it not really suported by custom anvil. targetCompatibility = "16" options.encoding = "UTF-8" From 6347db9167334558ff1d6a2fb4bf39c7c7fc0366 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 14:29:52 +0200 Subject: [PATCH 16/17] add small hash to actions name --- .github/workflows/gradle.yml | 16 +++++++--------- build.gradle.kts | 22 ++++++---------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 48f4c21..92d98e5 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -45,12 +45,10 @@ jobs: run: chmod +x ./gradlew - name: Get small commit hash - run: echo "small_commit_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV + run: echo "SMALL_COMMIT_HASH=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV - name: Build with Gradle Wrapper run: ./gradlew build --parallel - env: - SMALL_COMMIT_HASH: ${{ env.small_commit_hash }} # only submit dependency on push - name: Generate and submit dependency graph @@ -65,21 +63,21 @@ jobs: ONLINE_JAR_PATH=$(ls build/libs/CustomAnvil-*.jar | grep -v "offline") OFFLINE_JAR_PATH=$(ls build/libs/CustomAnvil-*-offline.jar) - echo "online_jar_name=$(basename $ONLINE_JAR_PATH)" >> $GITHUB_ENV - echo "offline_jar_name=$(basename $OFFLINE_JAR_PATH)" >> $GITHUB_ENV + echo "ONLINE_JAR_NAME=$(basename $ONLINE_JAR_PATH)" >> $GITHUB_ENV + echo "OFFLINE_JAR_NAME=$(basename $OFFLINE_JAR_PATH)" >> $GITHUB_ENV # upload the named jars - name: Upload online JAR artifact uses: actions/upload-artifact@v4 with: - name: ${{ env.online_jar_name }} - path: build/libs/${{ env.online_jar_name }} + name: ${{ env.ONLINE_JAR_NAME }} + path: build/libs/${{ env.ONLINE_JAR_NAME }} - name: Upload offline JAR file uses: actions/upload-artifact@v4 with: - name: ${{ env.offline_jar_name }} - path: build/libs/${{ env.offline_jar_name }} + name: ${{ env.OFFLINE_JAR_NAME }} + path: build/libs/${{ env.OFFLINE_JAR_NAME }} - name: Summarize tests results uses: jeantessier/test-summary-action@v1 diff --git a/build.gradle.kts b/build.gradle.kts index a7d3617..b9f1d69 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ group = "xyz.alexcrea" version = "1.11.3" val effectiveVersion = "$version" + - { (if (System.getenv("SMALL_COMMIT_HASH") != null) "-${System.getenv("SMALL_COMMIT_HASH")!!}" else "") } + (if (System.getenv("SMALL_COMMIT_HASH") != null) "-dev-${System.getenv("SMALL_COMMIT_HASH")!!}" else "") repositories { // EcoEnchants @@ -134,24 +134,13 @@ allprojects { } -// Fat-jar builder -val fatJar = tasks.register("fatJar") { - manifest { - attributes.apply { put("Main-Class", "io.delilaheve.CustomAnvil") } - } - - archiveFileName.set("${rootProject.name}-${effectiveVersion}.jar") - exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA") - duplicatesStrategy = DuplicatesStrategy.WARN - from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) - with(tasks.jar.get() as CopySpec) -} - tasks { + // Online jar (use of libraries) shadowJar { // No suffix for this jar - archiveClassifier.set("") + val name = "${rootProject.name}-${effectiveVersion}.jar" + archiveFileName.set(name) // Exclude kotlin std and its annotation exclude("**/kotlin-stdlib*.jar") @@ -181,7 +170,8 @@ tasks { // Add custom anvil compiled ::class, fun ShadowJar.() { - archiveClassifier.set("offline") + val name = "${rootProject.name}-${effectiveVersion}-offline.jar" + archiveFileName.set(name) // Shadow necessary dependency relocate("com.github.stefvanschie.inventoryframework", "xyz.alexcrea.inventoryframework") From d27419ef40f5097234b01cf94e05b2d65ccd6151 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Sat, 14 Jun 2025 15:51:14 +0200 Subject: [PATCH 17/17] make dependency graph push only --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 92d98e5..395c547 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -53,7 +53,7 @@ jobs: # only submit dependency on push - name: Generate and submit dependency graph uses: gradle/actions/dependency-submission@v4 - #if: ${{ github.event_name == 'push' && success() }} #temporarly disabled for test + if: ${{ github.event_name == 'push' && success() }} continue-on-error: true # Get the names of the online and offline jars