diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35f2bb6..9778ce9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,22 +14,25 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: ${{ matrix.java }} - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - uses: actions/cache@v3 + + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: ${{ runner.os }}-gradle- + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v2 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle run: ./gradlew build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74d927c..f06ebfb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,15 +2,16 @@ name: publish on: release: - types: [published] + types: [ published ] jobs: build: - name: publish runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + outputs: + mc_version: ${{ steps.split_tag.outputs.mc_version }} + mod_version: ${{ steps.split_tag.outputs.mod_version }} + steps: - name: Extract Version from Tag id: split_tag run: | @@ -20,60 +21,76 @@ jobs: echo "mod_version=${parts[1]}" >> $GITHUB_OUTPUT - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - uses: actions/cache@v3 + + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: ubuntu-latest-gradle- + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v2 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle run: ./gradlew -PmodVersion='${{ steps.split_tag.outputs.mod_version }}' build - - name: Remove extra JARs + - name: Remove shadow JARs run: | rm fabric/build/libs/*-dev-shadow.jar rm forge/build/libs/*-dev-shadow.jar + rm neoforge/build/libs/*-dev-shadow.jar - name: Add Artifacts to Github Release - uses: alexellis/upload-assets@0.4.0 + uses: alexellis/upload-assets@0.4.1 env: GITHUB_TOKEN: ${{ github.token }} with: - asset_paths: '["./forge/build/libs/*.jar","./fabric/build/libs/*.jar","./common/build/libs/*-api.jar"]' + asset_paths: '["./fabric/build/libs/*.jar","./forge/build/libs/*.jar","./neoforge/build/libs/*.jar","./common/build/libs/*-api.jar"]' - - name: Publish to Curseforge and Minotaur (Forge) - uses: Kir-Antipov/mc-publish@v3.3 + - uses: actions/upload-artifact@v4 + name: Upload Artifacts + id: upload-artifacts with: - name: ${{ github.event.repository.name }}-MC${{ steps.split_tag.outputs.mc_version }}-${{ steps.split_tag.outputs.mod_version }} - version: MC${{ steps.split_tag.outputs.mc_version }}-forge-${{ steps.split_tag.outputs.mod_version }} - java: Java 17 + name: jar-files + path: | + ./common/build/libs/*-api.jar + ./fabric/build/libs/*.jar + ./forge/build/libs/*.jar + ./neoforge/build/libs/*.jar + retention-days: 1 - files: | - forge/build/libs/*.jar - common/build/libs/*-api.jar + publish: + strategy: + matrix: + loader: [ fabric, forge, neoforge ] + runs-on: ubuntu-latest + needs: build - modrinth-token: ${{ secrets.MODRINTH_API_KEY }} - curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }} + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: jar-files - - name: Publish to Curseforge and Minotaur (Fabric) + - name: Publish (${{ matrix.loader }}) uses: Kir-Antipov/mc-publish@v3.3 with: - name: ${{ github.event.repository.name }}-MC${{ steps.split_tag.outputs.mc_version }}-${{ steps.split_tag.outputs.mod_version }} - version: MC${{ steps.split_tag.outputs.mc_version }}-fabric-${{ steps.split_tag.outputs.mod_version }} + name: ${{ github.event.repository.name }}-MC${{ needs.build.outputs.mc_version }}-${{ needs.build.outputs.mod_version }} + version: MC${{ needs.build.outputs.mc_version }}-${{ matrix.loader }}-${{ needs.build.outputs.mod_version }} java: Java 17 files: | - fabric/build/libs/*.jar common/build/libs/*-api.jar + ${{ matrix.loader }}/build/libs/*.jar modrinth-token: ${{ secrets.MODRINTH_API_KEY }} curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}