Build & Release Mod #6
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: Build & Release Mod | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "mod version" | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Verify Java version | |
| run: java -version | |
| - name: Make Gradle executable | |
| run: chmod +x ./gradlew | |
| - name: Build mod (force Java 21) | |
| run: ./gradlew build | |
| env: | |
| JAVA_HOME: ${{ env.JAVA_HOME_21_X64 }} | |
| - name: Find artifact (Mod JAR) | |
| id: findJar | |
| run: | | |
| FILE=$(find build/libs -name "*.jar" | head -n 1) | |
| echo "file=$FILE" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ github.event.inputs.version }} | |
| name: "Version ${{ github.event.inputs.version }}" | |
| files: ${{ steps.findJar.outputs.file }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |