Merge pull request #3251 from XeKr/assets/1.21 #1603
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI for AnvilCraftMod | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - releases/** | |
| - dev/** | |
| paths: | |
| - src/** | |
| - gradle/** | |
| - build.gradle | |
| - dependencies.gradle | |
| - gradle.properties | |
| - settings.gradle | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| BUILD_TYPE: snapshot | |
| VERSION_TYPE: alpha | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: Read Properties | |
| id: 'properties' | |
| uses: christian-draeger/[email protected] | |
| with: | |
| path: gradle.properties | |
| properties: 'mod_id mod_name java_version' | |
| - name: Setup Java ${{ steps.properties.outputs.java_version }} | |
| uses: actions/[email protected] | |
| 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/[email protected] | |
| - 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/[email protected] | |
| 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/[email protected] | |
| continue-on-error: false | |
| with: | |
| mod: build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar | |
| - name: publish neoforge mc mod | |
| uses: Kir-Antipov/[email protected] | |
| 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: Early test version, please download and play with caution. 早期测试版本,请谨慎下载游玩 | |
| modrinth-id: vuISAWPc | |
| modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
| modrinth-featured: true | |
| curseforge-id: 986251 | |
| curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | |
| files: | | |
| build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}.jar | |
| build/libs/anvilcraft-neoforge-${{ steps.version.outputs.version }}-sources.jar |