From 08ac9a0213d4c9bc2830b6431270cd706bd53e20 Mon Sep 17 00:00:00 2001 From: Gugle Date: Fri, 6 Dec 2024 20:48:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=84=E5=BB=BA=E8=84=9A?= =?UTF-8?q?=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 | 64 -------------- .github/workflows/21_pull_request.yml | 56 ------------- .github/workflows/21_release.yml | 83 ------------------ .github/workflows/ci.yml | 69 +++++++++++---- .github/workflows/pull_request.yml | 55 +++++++++--- .github/workflows/release.yml | 115 +++++++++++++++++++++---- gradle.properties | 1 - 11 files changed, 197 insertions(+), 520 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_pull_request.yml delete mode 100644 .github/workflows/21_release.yml diff --git a/.github/workflows/20_ci.yml b/.github/workflows/20_ci.yml deleted file mode 100644 index bd8770a75..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_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} - 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 4378f1d2b..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_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} - 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 834fe6d38..000000000 --- a/.github/workflows/21_ci.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CI for AnvilCraftMod 1.21.1+ -on: workflow_call - -jobs: - 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 - run: ./gradlew publish - env: - MAVEN_URL: ${{ secrets.MAVEN_URL }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} - continue-on-error: true - - - name: gametest - uses: Anvil-Dev/dedicated-server-launch-test@1.21-neoforge - with: - mod: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar - extra-mods: patchouli:1.21-87-neoforge cloth-config:15.0.140+neoforge diff --git a/.github/workflows/21_pull_request.yml b/.github/workflows/21_pull_request.yml deleted file mode 100644 index c4f047aa8..000000000 --- a/.github/workflows/21_pull_request.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Pull Request Check for AnvilCraftMod 1.21.1+ -on: workflow_call - -jobs: - 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 - - - name: gametest - uses: Anvil-Dev/dedicated-server-launch-test@1.21-neoforge - with: - mod: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar - extra-mods: patchouli:1.21-87-neoforge cloth-config:15.0.140+neoforge diff --git a/.github/workflows/21_release.yml b/.github/workflows/21_release.yml deleted file mode 100644 index 560c7a245..000000000 --- a/.github/workflows/21_release.yml +++ /dev/null @@ -1,83 +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 - run: ./gradlew publish - env: - MAVEN_URL: ${{ secrets.MAVEN_URL }} - MAVEN_USERNAME: ${{ secrets.MAVEN_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} - 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 index 188aa5889..22c0bda14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,9 @@ on: jobs: build: runs-on: ubuntu-latest - outputs: - ci_version: ${{ steps.properties.outputs.ci_version }} + env: + CI_BUILD: true + PR_BUILD: false steps: - name: checkout uses: actions/checkout@v4 @@ -30,16 +31,54 @@ jobs: 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' }} - secrets: inherit - uses: ./.github/workflows/20_ci.yml - - build-21: - needs: build - secrets: inherit - if: ${{ needs.build.outputs.ci_version == '21' }} - uses: ./.github/workflows/21_ci.yml \ No newline at end of file + 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_USER }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} + continue-on-error: true + + - name: Fabric Game Test + uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-fabric + with: + mod: fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + extra-mods: fabric-api:0.92.2+1.20.1 patchouli:1.20.1-84-fabric cloth-config:11.1.136+fabric + + - name: Forge Game Test + uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-forge + with: + mod: forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + extra-mods: patchouli:1.20.1-84-forge cloth-config:11.1.136+forge diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 54c88fe37..cfa5b8780 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -16,8 +16,9 @@ on: jobs: build: runs-on: ubuntu-latest - outputs: - ci_version: ${{ steps.properties.outputs.ci_version }} + env: + CI_BUILD: true + PR_BUILD: true steps: - name: checkout uses: actions/checkout@v4 @@ -30,14 +31,46 @@ jobs: uses: christian-draeger/read-properties@1.1.1 with: path: gradle.properties - properties: 'ci_version' + properties: 'mod_id mod_name java_version' - build-20: - needs: build - if: ${{ needs.build.outputs.ci_version == '20' }} - uses: ./.github/workflows/20_pull_request.yml + - 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 - build-21: - needs: build - if: ${{ needs.build.outputs.ci_version == '21' }} - uses: ./.github/workflows/21_pull_request.yml + - 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: Fabric Game Test + uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-fabric + with: + mod: fabric/build/libs/anvilcraft-fabric-${{ steps.version.outputs.version }}.jar + extra-mods: fabric-api:0.92.2+1.20.1 patchouli:1.20.1-84-fabric cloth-config:11.1.136+fabric + + - name: Forge Game Test + uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-forge + with: + mod: forge/build/libs/anvilcraft-forge-${{ steps.version.outputs.version }}.jar + extra-mods: patchouli:1.20.1-84-forge cloth-config:11.1.136+forge diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c479cbad8..4d35623d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,31 +6,114 @@ on: jobs: build: + permissions: write-all runs-on: ubuntu-latest - outputs: - ci_version: ${{ steps.properties.outputs.ci_version }} + 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 + uses: gradle/wrapper-validation-action@v1 - name: Read Properties id: 'properties' uses: christian-draeger/read-properties@1.1.1 with: path: gradle.properties - properties: 'ci_version' - - build-20: - needs: build - secrets: inherit - if: ${{ needs.build.outputs.ci_version == '20' }} - uses: ./.github/workflows/20_release.yml - - build-21: - needs: build - secrets: inherit - if: ${{ needs.build.outputs.ci_version == '21' }} - uses: ./.github/workflows/21_release.yml + 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_USER }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }} + 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/gradle.properties b/gradle.properties index 0eda2fe49..e76e321b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,6 @@ supporters=- Fengyuan__\n- BOTXue\n- Take\n- Moe_Lobster\n- a_yangX_Y mod_license=LGPL-3.0 license mod_version=1.4.1+pre-release.2 mod_url=https://github.com/Anvil-Dev/AnvilCraft -ci_version=20 # Development info maven_group=dev.dubhe enabled_platforms=fabric,forge