From 181d283234d2ecc697709457ec805cf214d05412 Mon Sep 17 00:00:00 2001 From: ZhuRuoLing <3489382552@qq.com> Date: Tue, 3 Dec 2024 23:28:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/20_ci.yml | 64 -------------- .github/workflows/20_gametest.yml | 39 --------- .github/workflows/20_pull_request.yml | 55 ------------ .github/workflows/20_release.yml | 116 -------------------------- .github/workflows/21_ci.yml | 62 -------------- .github/workflows/21_gametest.yml | 36 -------- .github/workflows/21_pull_request.yml | 53 ------------ .github/workflows/21_release.yml | 84 ------------------- .github/workflows/ci.yml | 43 ---------- .github/workflows/pull_request.yml | 43 ---------- .github/workflows/release.yml | 34 -------- dependencies.gradle | 35 ++++---- gradle/libs.versions.toml | 45 ++++++++++ gradle/scripts/moddevgradle.gradle | 2 +- settings.gradle | 78 ----------------- 15 files changed, 63 insertions(+), 726 deletions(-) delete mode 100644 .github/workflows/20_ci.yml delete mode 100644 .github/workflows/20_gametest.yml delete mode 100644 .github/workflows/20_pull_request.yml delete mode 100644 .github/workflows/20_release.yml delete mode 100644 .github/workflows/21_ci.yml delete mode 100644 .github/workflows/21_gametest.yml delete mode 100644 .github/workflows/21_pull_request.yml delete mode 100644 .github/workflows/21_release.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/pull_request.yml delete mode 100644 .github/workflows/release.yml create mode 100644 gradle/libs.versions.toml diff --git a/.github/workflows/20_ci.yml b/.github/workflows/20_ci.yml deleted file mode 100644 index 0eeaa2220..000000000 --- a/.github/workflows/20_ci.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CI for AnvilCraftMod 1.20.1- -on: workflow_call - - -jobs: - gametest: - secrets: inherit - uses: ./.github/workflows/20_gametest.yml - build: - runs-on: ubuntu-latest - env: - CI_BUILD: true - PR_BUILD: false - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'mod_id mod_name java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Build - run: ./gradlew build - - - name: Get Version - id: version - run: | - MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}') - echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - - name: capture build artifacts - uses: actions/upload-artifact@v4.3.3 - with: - name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" - path: | - fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar - forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar - - - name: Publish to maven - run: ./gradlew publish - env: - MAVEN_URL: ${{ secrets.MAVEN_URL }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - continue-on-error: true diff --git a/.github/workflows/20_gametest.yml b/.github/workflows/20_gametest.yml deleted file mode 100644 index f1fd3ebd2..000000000 --- a/.github/workflows/20_gametest.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: GameTest for AnvilCraftMod 1.20.1- -on: workflow_call - -jobs: - test: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Run Fabric GameTest - run: ./gradlew anvilcraft-fabric:runGameTestServer - - - name: Run Forge GameTest - run: ./gradlew anvilcraft-forge:runGameTestServer diff --git a/.github/workflows/20_pull_request.yml b/.github/workflows/20_pull_request.yml deleted file mode 100644 index fadfb55d3..000000000 --- a/.github/workflows/20_pull_request.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Pull Request Check for AnvilCraftMod 1.20.1- -on: workflow_call - -jobs: - gametest: - secrets: inherit - uses: ./.github/workflows/20_gametest.yml - build: - runs-on: ubuntu-latest - env: - CI_BUILD: true - PR_BUILD: true - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'mod_id mod_name java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Build - run: ./gradlew build - - - name: Get Version - id: version - run: | - MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}') - echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - - name: capture build artifacts - uses: actions/upload-artifact@v4.3.3 - with: - name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" - path: | - fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar - forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar \ No newline at end of file diff --git a/.github/workflows/20_release.yml b/.github/workflows/20_release.yml deleted file mode 100644 index 32b85fb4e..000000000 --- a/.github/workflows/20_release.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: Upload Release Asset for AnvilCraftMod 1.20.1- -on: workflow_call - -jobs: - build: - permissions: write-all - runs-on: ubuntu-latest - env: - CI_BUILD: false - PR_BUILD: false - VERSION_TYPE: ${{ github.event.release.prerelease && 'alpha' || 'release' }} - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'mod_id mod_name java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Build - run: ./gradlew build - - - name: Get Version - id: version - run: | - MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}') - echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - - name: capture build artifacts - uses: actions/upload-artifact@v3.1.1 - with: - name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" - path: | - fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar - forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar - - - name: Publish to maven - run: ./gradlew publish - env: - MAVEN_URL: ${{ secrets.MAVEN_URL }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - continue-on-error: true - - - name: Upload Release Jar - uses: softprops/action-gh-release@v0.1.15 - with: - files: | - fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar - forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar - - - name: publish forge mc mod - uses: Kir-Antipov/mc-publish@v3.3 - continue-on-error: true - with: - name: "${{ steps.properties.outputs.mod_name }} For Forge v${{ steps.version.outputs.version }}" - version: ${{ steps.version.outputs.version }} - game-versions: 1.20.1 - version-type: ${{ env.VERSION_TYPE }} - java: 17 - fail-mode: skip - changelog: ${{ github.event.release.body }} - - modrinth-id: vuISAWPc - modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - modrinth-featured: true - - curseforge-id: 986251 - curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - - files: | - forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar - forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}-sources.jar - - - - name: publish fabric mc mod - uses: Kir-Antipov/mc-publish@v3.3 - continue-on-error: true - with: - name: "${{ steps.properties.outputs.mod_name }} For Fabric v${{ steps.version.outputs.version }}" - version: ${{ steps.version.outputs.version }} - game-versions: 1.20.1 - version-type: ${{ env.VERSION_TYPE }} - java: 17 - fail-mode: skip - changelog: ${{ github.event.release.body }} - - modrinth-id: vuISAWPc - modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - modrinth-featured: true - - curseforge-id: 986251 - curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - - files: | - fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar - fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}-sources.jar diff --git a/.github/workflows/21_ci.yml b/.github/workflows/21_ci.yml deleted file mode 100644 index 6389c9250..000000000 --- a/.github/workflows/21_ci.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: CI for AnvilCraftMod 1.21.1+ -on: workflow_call - -jobs: - gametest: - secrets: inherit - uses: ./.github/workflows/21_gametest.yml - build: - runs-on: ubuntu-latest - env: - CI_BUILD: true - PR_BUILD: false - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'mod_id mod_name java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Build - run: ./gradlew build - - - name: Get Version - id: version - run: | - MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}') - echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - - name: capture build artifacts - uses: actions/upload-artifact@v4.3.3 - with: - name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" - path: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar - - - name: Publish to maven - if: ${{ github.event.inputs.publish == 'true' }} - run: ./gradlew publish - env: - MAVEN_URL: ${{ secrets.MAVEN_URL }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - continue-on-error: true diff --git a/.github/workflows/21_gametest.yml b/.github/workflows/21_gametest.yml deleted file mode 100644 index 56a278332..000000000 --- a/.github/workflows/21_gametest.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: GameTest for AnvilCraftMod 1.21.1+ -on: workflow_call - -jobs: - test: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Run GameTest - run: ./gradlew runGameTestServer diff --git a/.github/workflows/21_pull_request.yml b/.github/workflows/21_pull_request.yml deleted file mode 100644 index c94249ce6..000000000 --- a/.github/workflows/21_pull_request.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Pull Request Check for AnvilCraftMod 1.21.1+ -on: workflow_call - -jobs: - gametest: - secrets: inherit - uses: ./.github/workflows/21_gametest.yml - build: - runs-on: ubuntu-latest - env: - CI_BUILD: true - PR_BUILD: true - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'mod_id mod_name java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Build - run: ./gradlew build - - - name: Get Version - id: version - run: | - MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}') - echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - - name: capture build artifacts - uses: actions/upload-artifact@v4.3.3 - with: - name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" - path: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar diff --git a/.github/workflows/21_release.yml b/.github/workflows/21_release.yml deleted file mode 100644 index 45130843d..000000000 --- a/.github/workflows/21_release.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Upload Release Asset for AnvilCraftMod 1.21.1+ -on: workflow_call - -jobs: - build: - permissions: write-all - runs-on: ubuntu-latest - env: - CI_BUILD: false - PR_BUILD: false - VERSION_TYPE: ${{ github.event.release.prerelease && 'alpha' || 'release' }} - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'mod_id mod_name java_version' - - - name: Setup Java ${{ steps.properties.outputs.java_version }} - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: ${{ steps.properties.outputs.java_version }} - - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} - run: chmod +x ./gradlew - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Build - run: ./gradlew build - - - name: Get Version - id: version - run: | - MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}') - echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - - name: capture build artifacts - uses: actions/upload-artifact@v4.3.3 - with: - name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" - path: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar - - - name: Publish to maven - if: ${{ github.event.inputs.publish == 'true' }} - run: ./gradlew publish - env: - MAVEN_URL: ${{ secrets.MAVEN_URL }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - continue-on-error: true - - - name: publish neoforge mc mod - uses: Kir-Antipov/mc-publish@v3.3 - continue-on-error: true - with: - name: "${{ steps.properties.outputs.mod_name }} For NeoForge v${{ steps.version.outputs.version }}" - version: ${{ steps.version.outputs.version }} - game-versions: 1.21.1 - version-type: ${{ env.VERSION_TYPE }} - java: 21 - fail-mode: skip - changelog: ${{ github.event.release.body }} - - modrinth-id: vuISAWPc - modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - modrinth-featured: true - - curseforge-id: 986251 - curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - - files: | - build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar - build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}-sources.jar diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 636934202..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: CI for AnvilCraftMod -on: - workflow_dispatch: - push: - branches: - - releases/** - paths: - - src/** - - common/** - - fabric/** - - forge/** - - build.gradle - - gradle.properties - - settings.gradle - -jobs: - build: - runs-on: ubuntu-latest - outputs: - ci_version: ${{ steps.properties.outputs.ci_version }} - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'ci_version' - - build-20: - needs: build - if: ${{ needs.build.outputs.ci_version == '20' }} - uses: ./.github/workflows/20_ci.yml - - build-21: - needs: build - if: ${{ needs.build.outputs.ci_version == '21' }} - uses: ./.github/workflows/21_ci.yml \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index c47c6e0e4..000000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Pull Request Check -on: - workflow_dispatch: - push: - branches: - - releases/** - paths: - - src/** - - common/** - - fabric/** - - forge/** - - build.gradle - - gradle.properties - - settings.gradle - -jobs: - build: - runs-on: ubuntu-latest - outputs: - ci_version: ${{ steps.properties.outputs.ci_version }} - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'ci_version' - - build-20: - needs: build - if: ${{ needs.build.outputs.ci_version == '20' }} - uses: ./.github/workflows/20_pull_request.yml - - build-21: - needs: build - if: ${{ needs.build.outputs.ci_version == '21' }} - uses: ./.github/workflows/21_pull_request.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index d9e664dc3..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Upload Release Asset -on: - workflow_dispatch: - release: - types: [ published ] - -jobs: - build: - runs-on: ubuntu-latest - outputs: - ci_version: ${{ steps.properties.outputs.ci_version }} - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: validate gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Read Properties - id: 'properties' - uses: christian-draeger/read-properties@1.1.1 - with: - path: gradle.properties - properties: 'ci_version' - - build-20: - needs: build - if: ${{ needs.build.outputs.ci_version == '20' }} - uses: ./.github/workflows/20_release.yml - - build-21: - needs: build - if: ${{ needs.build.outputs.ci_version == '21' }} - uses: ./.github/workflows/21_release.yml diff --git a/dependencies.gradle b/dependencies.gradle index c45f12d55..a781d2852 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,32 +1,31 @@ dependencies { - // Registrate - api("com.tterrag.registrate:Registrate:${forge.versions.registrate.get()}") - jarJar("com.tterrag.registrate:Registrate:${forge.versions.registrate.get()}") + api("com.tterrag.registrate:Registrate:${libs.versions.registrate.get()}") + jarJar("com.tterrag.registrate:Registrate:${libs.versions.registrate.get()}") - implementation(forge.clothConfig) + implementation(libs.clothConfig) // JEI - compileOnlyApi(forge.jei.common.api) { transitive = false } - compileOnlyApi(forge.jei.forge.api) { transitive = false } - implementation(forge.jei.forge.impl) { transitive = false } + compileOnlyApi(libs.jeiCommonApi) { transitive = false } + compileOnlyApi(libs.jeiForgeApi) { transitive = false } + implementation(libs.jeiForgeImpl) { transitive = false } // REI - compileOnlyApi(forge.rei.plugin) - compileOnlyApi(forge.rei.api) - compileOnly(forge.rei.forge) + compileOnlyApi(libs.reiPlugin) + compileOnlyApi(libs.reiApi) + compileOnly(libs.reiForge) // EMI - compileOnlyApi("dev.emi:emi-neoforge:${forge.versions.emi.get()}:api") - implementation(forge.emi) + compileOnlyApi("dev.emi:emi-neoforge:${libs.versions.emi.get()}:api") + compileOnly(libs.emi) // Patchouli - compileOnlyApi("vazkii.patchouli:Patchouli:${forge.versions.patchouli.get()}:api") - runtimeOnly(forge.patchouli) + compileOnlyApi("vazkii.patchouli:Patchouli:${libs.versions.patchouli.get()}:api") + runtimeOnly(libs.patchouli) - implementation(forge.jade) - implementation(forge.theoneprobe) - - implementation(forge.kubejs) + implementation(libs.jade) + implementation(libs.theoneprobe) + implementation(libs.kubejs) +} // compileOnly("maven.modrinth:sodium:mc1.21.1-0.6.0-beta.4-neoforge") // compileOnly("maven.modrinth:iris:1.8.0-beta.5+1.21-neoforge") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..66a2b17e7 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,45 @@ +[versions] +minecraft = "1.21.1" +neoForge = "21.1.79" +registrate = "MC1.21-1.3.0+55" +clothConfig = "15.0.130" +jei = "19.17.0.193" +rei = "16.0.762" +emi = "1.1.13+1.21.1" +jade = "15.3.4+neoforge" +theoneprobe = "1.21_neo-12.0.3-5" +kubejs = "2101.7.0-build.126" +patchouli = "1.21-87-NEOFORGE" +parchment = "2024.07.28" +modDevGradle = "2.0.34-beta" +spotless = "7.0.0.BETA2" +lombok = "8.7.1" +machete = "1.+" + +[libraries] +neoForge = { group = "net.neoforged", name = "neoforge", version.ref = "neoForge" } +registrate = { group = "com.tterrag.registrate", name = "Registrate", version.ref = "registrate" } +clothConfig = { group = "me.shedaniel.cloth", name = "cloth-config-neoforge", version.ref = "clothConfig" } + +jeiCommonApi = { group = "mezz.jei", name = "jei-1.21.1-common-api", version.ref = "jei" } +jeiForgeApi = { group = "mezz.jei", name = "jei-1.21.1-neoforge-api", version.ref = "jei" } +jeiForgeImpl = { group = "mezz.jei", name = "jei-1.21.1-neoforge", version.ref = "jei" } + +reiPlugin = { group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin-neoforge", version.ref = "rei" } +reiApi = { group = "me.shedaniel", name = "RoughlyEnoughItems-api-neoforge", version.ref = "rei" } +reiForge = { group = "me.shedaniel", name = "RoughlyEnoughItems-neoforge", version.ref = "rei" } + +emi = { group = "dev.emi", name = "emi-neoforge", version.ref = "emi" } + +jade = { group = "maven.modrinth", name = "jade", version.ref = "jade" } +theoneprobe = { group = "mcjty.theoneprobe", name = "theoneprobe", version.ref = "theoneprobe" } + +kubejs = { group = "dev.latvian.mods", name = "kubejs-neoforge", version.ref = "kubejs" } + +patchouli = { group = "vazkii.patchouli", name = "Patchouli", version.ref = "patchouli" } + +[plugins] +modDevGradle = { id = "net.neoforged.moddev", version.ref = "modDevGradle" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +lombok = { id = "io.freefair.lombok", version.ref = "lombok" } +machete = { id = "io.github.p03w.machete", version.ref = "machete" } diff --git a/gradle/scripts/moddevgradle.gradle b/gradle/scripts/moddevgradle.gradle index e145dafee..7e683806f 100644 --- a/gradle/scripts/moddevgradle.gradle +++ b/gradle/scripts/moddevgradle.gradle @@ -1,5 +1,5 @@ neoForge { - version = forge.versions.neoForge.get() + version = libs.versions.neoForge.get() parchment { minecraftVersion = "1.21" diff --git a/settings.gradle b/settings.gradle index ffa7dd316..a628bc758 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,82 +20,4 @@ dependencyResolutionManagement { repositories { mavenCentral() } - - versionCatalogs { - def minecraftVersion = "1.21.1" - - // Mod Dependencies Versions - def neoForgeVersion = "21.1.79" - def registrateVersion = "MC1.21-1.3.0+55" - def clothConfigVersion = "15.0.130" - - def jeiVersion = "19.17.0.193" - def reiVersion = "16.0.762" - def emiVersion = "1.1.13" - - def jadeVersion = "15.3.4+neoforge" - def topVersion = "1.21_neo-12.0.3-5" - def kjsVersion = "2101.7.0-build.126" - def patchouliVersion = "1.21-87" - - def parchmentVersion = "2024.07.28" // https://parchmentmc.org/docs/getting-started - - def modDevGradleVersion = "2.0.34-beta" - def spotlessPluginVersion = "7.0.0.BETA2" - def lombokPluginVersion = "8.7.1" - def machetePluginVersion = "1.+" - - forge { - def neoForge = version("neoForge", neoForgeVersion) - library("neoForge", "net.neoforged", "neoforge").versionRef(neoForge) - - def registrate = version("registrate", registrateVersion) - library("registrate", "com.tterrag.registrate", "Registrate").versionRef(registrate) - - def clothConfig = version("clothConfig", clothConfigVersion) - library("clothConfig", "me.shedaniel.cloth", "cloth-config-neoforge").versionRef(clothConfig) - - def jei = version("jei", jeiVersion) - library("jei-common-api", "mezz.jei", "jei-${minecraftVersion}-common-api").versionRef(jei) - library("jei-forge-api", "mezz.jei", "jei-${minecraftVersion}-neoforge-api").versionRef(jei) - library("jei-forge-impl", "mezz.jei", "jei-${minecraftVersion}-neoforge").versionRef(jei) - - def rei = version("rei", reiVersion) - library("rei-plugin", "me.shedaniel", "RoughlyEnoughItems-default-plugin-neoforge").versionRef(rei) - library("rei-api", "me.shedaniel", "RoughlyEnoughItems-api-neoforge").versionRef(rei) - library("rei-forge", "me.shedaniel", "RoughlyEnoughItems-neoforge").versionRef(rei) - - def emi = version("emi", emiVersion + "+" + minecraftVersion) - library("emi", "dev.emi", "emi-neoforge").versionRef(emi) - - def jade = version("jade", jadeVersion) - library("jade", "maven.modrinth", "jade").versionRef(jade) - - def theoneprobe = version("theoneprobe", topVersion) - library("theoneprobe", "mcjty.theoneprobe", "theoneprobe").versionRef(theoneprobe) - - def kubejs = version("kubejs", kjsVersion) - library("kubejs", "dev.latvian.mods", "kubejs-neoforge").versionRef(kubejs) - - def patchouli = version("patchouli", "${patchouliVersion}-NEOFORGE") - library("patchouli", "vazkii.patchouli", "Patchouli").versionRef(patchouli) - } - - libs { - version("parchment", parchmentVersion) - version("minecraft", minecraftVersion) - - def modDevGradle = version("modDevGradle", modDevGradleVersion) - plugin("modDevGradle", "net.neoforged.moddev").versionRef(modDevGradle) - - def spotless = version("spotless", spotlessPluginVersion) - plugin("spotless", "com.diffplug.spotless").versionRef(spotless) - - def lombok = version("lombok", lombokPluginVersion) - plugin("lombok", "io.freefair.lombok").versionRef(lombok) - - def machete = version("machete", machetePluginVersion) - plugin("machete", "io.github.p03w.machete").versionRef(machete) - } - } } From d19be6aeb92241740e53c5a46c88aec1669eba6f Mon Sep 17 00:00:00 2001 From: ZhuRuoLing <3489382552@qq.com> Date: Tue, 3 Dec 2024 23:37:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Revert:=20=E5=88=A0=E9=99=A4=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/20_ci.yml | 64 ++++++++++++++ .github/workflows/20_gametest.yml | 39 +++++++++ .github/workflows/20_pull_request.yml | 55 ++++++++++++ .github/workflows/20_release.yml | 116 ++++++++++++++++++++++++++ .github/workflows/21_ci.yml | 62 ++++++++++++++ .github/workflows/21_gametest.yml | 36 ++++++++ .github/workflows/21_pull_request.yml | 53 ++++++++++++ .github/workflows/21_release.yml | 84 +++++++++++++++++++ .github/workflows/ci.yml | 43 ++++++++++ .github/workflows/pull_request.yml | 43 ++++++++++ .github/workflows/release.yml | 34 ++++++++ 11 files changed, 629 insertions(+) create mode 100644 .github/workflows/20_ci.yml create mode 100644 .github/workflows/20_gametest.yml create mode 100644 .github/workflows/20_pull_request.yml create mode 100644 .github/workflows/20_release.yml create mode 100644 .github/workflows/21_ci.yml create mode 100644 .github/workflows/21_gametest.yml create mode 100644 .github/workflows/21_pull_request.yml create mode 100644 .github/workflows/21_release.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/20_ci.yml b/.github/workflows/20_ci.yml new file mode 100644 index 000000000..0eeaa2220 --- /dev/null +++ b/.github/workflows/20_ci.yml @@ -0,0 +1,64 @@ +name: CI for AnvilCraftMod 1.20.1- +on: workflow_call + + +jobs: + gametest: + secrets: inherit + uses: ./.github/workflows/20_gametest.yml + build: + runs-on: ubuntu-latest + env: + CI_BUILD: true + PR_BUILD: false + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_id mod_name java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew build + + - name: Get Version + id: version + run: | + MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}') + echo "version=$MESSAGE" >> $GITHUB_OUTPUT + + - name: capture build artifacts + uses: actions/upload-artifact@v4.3.3 + with: + name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" + path: | + fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + + - name: Publish to maven + run: ./gradlew publish + env: + MAVEN_URL: ${{ secrets.MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + continue-on-error: true diff --git a/.github/workflows/20_gametest.yml b/.github/workflows/20_gametest.yml new file mode 100644 index 000000000..f1fd3ebd2 --- /dev/null +++ b/.github/workflows/20_gametest.yml @@ -0,0 +1,39 @@ +name: GameTest for AnvilCraftMod 1.20.1- +on: workflow_call + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Run Fabric GameTest + run: ./gradlew anvilcraft-fabric:runGameTestServer + + - name: Run Forge GameTest + run: ./gradlew anvilcraft-forge:runGameTestServer diff --git a/.github/workflows/20_pull_request.yml b/.github/workflows/20_pull_request.yml new file mode 100644 index 000000000..fadfb55d3 --- /dev/null +++ b/.github/workflows/20_pull_request.yml @@ -0,0 +1,55 @@ +name: Pull Request Check for AnvilCraftMod 1.20.1- +on: workflow_call + +jobs: + gametest: + secrets: inherit + uses: ./.github/workflows/20_gametest.yml + build: + runs-on: ubuntu-latest + env: + CI_BUILD: true + PR_BUILD: true + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_id mod_name java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew build + + - name: Get Version + id: version + run: | + MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}') + echo "version=$MESSAGE" >> $GITHUB_OUTPUT + + - name: capture build artifacts + uses: actions/upload-artifact@v4.3.3 + with: + name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" + path: | + fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar \ No newline at end of file diff --git a/.github/workflows/20_release.yml b/.github/workflows/20_release.yml new file mode 100644 index 000000000..32b85fb4e --- /dev/null +++ b/.github/workflows/20_release.yml @@ -0,0 +1,116 @@ +name: Upload Release Asset for AnvilCraftMod 1.20.1- +on: workflow_call + +jobs: + build: + permissions: write-all + runs-on: ubuntu-latest + env: + CI_BUILD: false + PR_BUILD: false + VERSION_TYPE: ${{ github.event.release.prerelease && 'alpha' || 'release' }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_id mod_name java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew build + + - name: Get Version + id: version + run: | + MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}') + echo "version=$MESSAGE" >> $GITHUB_OUTPUT + + - name: capture build artifacts + uses: actions/upload-artifact@v3.1.1 + with: + name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" + path: | + fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + + - name: Publish to maven + run: ./gradlew publish + env: + MAVEN_URL: ${{ secrets.MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + continue-on-error: true + + - name: Upload Release Jar + uses: softprops/action-gh-release@v0.1.15 + with: + files: | + fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + + - name: publish forge mc mod + uses: Kir-Antipov/mc-publish@v3.3 + continue-on-error: true + with: + name: "${{ steps.properties.outputs.mod_name }} For Forge v${{ steps.version.outputs.version }}" + version: ${{ steps.version.outputs.version }} + game-versions: 1.20.1 + version-type: ${{ env.VERSION_TYPE }} + java: 17 + fail-mode: skip + changelog: ${{ github.event.release.body }} + + modrinth-id: vuISAWPc + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + modrinth-featured: true + + curseforge-id: 986251 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + + files: | + forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}-sources.jar + + + - name: publish fabric mc mod + uses: Kir-Antipov/mc-publish@v3.3 + continue-on-error: true + with: + name: "${{ steps.properties.outputs.mod_name }} For Fabric v${{ steps.version.outputs.version }}" + version: ${{ steps.version.outputs.version }} + game-versions: 1.20.1 + version-type: ${{ env.VERSION_TYPE }} + java: 17 + fail-mode: skip + changelog: ${{ github.event.release.body }} + + modrinth-id: vuISAWPc + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + modrinth-featured: true + + curseforge-id: 986251 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + + files: | + fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}-sources.jar diff --git a/.github/workflows/21_ci.yml b/.github/workflows/21_ci.yml new file mode 100644 index 000000000..6389c9250 --- /dev/null +++ b/.github/workflows/21_ci.yml @@ -0,0 +1,62 @@ +name: CI for AnvilCraftMod 1.21.1+ +on: workflow_call + +jobs: + gametest: + secrets: inherit + uses: ./.github/workflows/21_gametest.yml + build: + runs-on: ubuntu-latest + env: + CI_BUILD: true + PR_BUILD: false + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_id mod_name java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew build + + - name: Get Version + id: version + run: | + MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}') + echo "version=$MESSAGE" >> $GITHUB_OUTPUT + + - name: capture build artifacts + uses: actions/upload-artifact@v4.3.3 + with: + name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" + path: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar + + - name: Publish to maven + if: ${{ github.event.inputs.publish == 'true' }} + run: ./gradlew publish + env: + MAVEN_URL: ${{ secrets.MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + continue-on-error: true diff --git a/.github/workflows/21_gametest.yml b/.github/workflows/21_gametest.yml new file mode 100644 index 000000000..56a278332 --- /dev/null +++ b/.github/workflows/21_gametest.yml @@ -0,0 +1,36 @@ +name: GameTest for AnvilCraftMod 1.21.1+ +on: workflow_call + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Run GameTest + run: ./gradlew runGameTestServer diff --git a/.github/workflows/21_pull_request.yml b/.github/workflows/21_pull_request.yml new file mode 100644 index 000000000..c94249ce6 --- /dev/null +++ b/.github/workflows/21_pull_request.yml @@ -0,0 +1,53 @@ +name: Pull Request Check for AnvilCraftMod 1.21.1+ +on: workflow_call + +jobs: + gametest: + secrets: inherit + uses: ./.github/workflows/21_gametest.yml + build: + runs-on: ubuntu-latest + env: + CI_BUILD: true + PR_BUILD: true + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_id mod_name java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew build + + - name: Get Version + id: version + run: | + MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}') + echo "version=$MESSAGE" >> $GITHUB_OUTPUT + + - name: capture build artifacts + uses: actions/upload-artifact@v4.3.3 + with: + name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" + path: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar diff --git a/.github/workflows/21_release.yml b/.github/workflows/21_release.yml new file mode 100644 index 000000000..45130843d --- /dev/null +++ b/.github/workflows/21_release.yml @@ -0,0 +1,84 @@ +name: Upload Release Asset for AnvilCraftMod 1.21.1+ +on: workflow_call + +jobs: + build: + permissions: write-all + runs-on: ubuntu-latest + env: + CI_BUILD: false + PR_BUILD: false + VERSION_TYPE: ${{ github.event.release.prerelease && 'alpha' || 'release' }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'mod_id mod_name java_version' + + - name: Setup Java ${{ steps.properties.outputs.java_version }} + uses: actions/setup-java@v3.6.0 + with: + distribution: zulu + java-version: ${{ steps.properties.outputs.java_version }} + + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + - name: Build with Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build + run: ./gradlew build + + - name: Get Version + id: version + run: | + MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}') + echo "version=$MESSAGE" >> $GITHUB_OUTPUT + + - name: capture build artifacts + uses: actions/upload-artifact@v4.3.3 + with: + name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}" + path: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar + + - name: Publish to maven + if: ${{ github.event.inputs.publish == 'true' }} + run: ./gradlew publish + env: + MAVEN_URL: ${{ secrets.MAVEN_URL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + continue-on-error: true + + - name: publish neoforge mc mod + uses: Kir-Antipov/mc-publish@v3.3 + continue-on-error: true + with: + name: "${{ steps.properties.outputs.mod_name }} For NeoForge v${{ steps.version.outputs.version }}" + version: ${{ steps.version.outputs.version }} + game-versions: 1.21.1 + version-type: ${{ env.VERSION_TYPE }} + java: 21 + fail-mode: skip + changelog: ${{ github.event.release.body }} + + modrinth-id: vuISAWPc + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + modrinth-featured: true + + curseforge-id: 986251 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + + files: | + build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}-sources.jar diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..636934202 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI for AnvilCraftMod +on: + workflow_dispatch: + push: + branches: + - releases/** + paths: + - src/** + - common/** + - fabric/** + - forge/** + - build.gradle + - gradle.properties + - settings.gradle + +jobs: + build: + runs-on: ubuntu-latest + outputs: + ci_version: ${{ steps.properties.outputs.ci_version }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'ci_version' + + build-20: + needs: build + if: ${{ needs.build.outputs.ci_version == '20' }} + uses: ./.github/workflows/20_ci.yml + + build-21: + needs: build + if: ${{ needs.build.outputs.ci_version == '21' }} + uses: ./.github/workflows/21_ci.yml \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..c47c6e0e4 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,43 @@ +name: Pull Request Check +on: + workflow_dispatch: + push: + branches: + - releases/** + paths: + - src/** + - common/** + - fabric/** + - forge/** + - build.gradle + - gradle.properties + - settings.gradle + +jobs: + build: + runs-on: ubuntu-latest + outputs: + ci_version: ${{ steps.properties.outputs.ci_version }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'ci_version' + + build-20: + needs: build + if: ${{ needs.build.outputs.ci_version == '20' }} + uses: ./.github/workflows/20_pull_request.yml + + build-21: + needs: build + if: ${{ needs.build.outputs.ci_version == '21' }} + uses: ./.github/workflows/21_pull_request.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..d9e664dc3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Upload Release Asset +on: + workflow_dispatch: + release: + types: [ published ] + +jobs: + build: + runs-on: ubuntu-latest + outputs: + ci_version: ${{ steps.properties.outputs.ci_version }} + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: validate gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Read Properties + id: 'properties' + uses: christian-draeger/read-properties@1.1.1 + with: + path: gradle.properties + properties: 'ci_version' + + build-20: + needs: build + if: ${{ needs.build.outputs.ci_version == '20' }} + uses: ./.github/workflows/20_release.yml + + build-21: + needs: build + if: ${{ needs.build.outputs.ci_version == '21' }} + uses: ./.github/workflows/21_release.yml From abf1cbc847990b11fe399b86898e090c073ff7bf Mon Sep 17 00:00:00 2001 From: Gugle Date: Tue, 3 Dec 2024 23:39:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20style=5Fcheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/style_check.yml | 29 --- style.xml | 341 ------------------------------ 2 files changed, 370 deletions(-) delete mode 100644 .github/workflows/style_check.yml delete mode 100644 style.xml diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml deleted file mode 100644 index e3f2043db..000000000 --- a/.github/workflows/style_check.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Style Check in CI -on: - push: - branches: - - releases/** - pull_request: - branches: - - releases/** - -jobs: - checkstyle: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3.1.0 - - name: Setup Java 17 - uses: actions/setup-java@v3.6.0 - with: - distribution: zulu - java-version: 17 - - uses: reviewdog/action-setup@v1 - with: - reviewdog_version: latest - - name: download checkstyle - run: curl -o checkstyle.jar -L https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.15.0/checkstyle-10.15.0-all.jar - - name: checkstyle - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: java -jar checkstyle.jar -c style.xml -f xml common/src fabric/src forge/src | reviewdog -f=checkstyle -name="Checkstyle" -reporter=github-check -level=warning diff --git a/style.xml b/style.xml deleted file mode 100644 index a96518630..000000000 --- a/style.xml +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file