Skip to content

Build Fabric Mod

Build Fabric Mod #37

Workflow file for this run

name: Build Fabric Mod
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Cache Gradle Packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Set mod_version in gradle.properties
run: echo "mod_version=${{ github.run_number }}" >> gradle.properties
- name: Build with Gradle
run: ./gradlew build
- name: Find Main JAR File
id: find_jar
run: |
JAR_FILE=$(ls build/libs/*.jar | grep -v -- "-sources.jar")
echo "JAR_FILE=$JAR_FILE" >> $GITHUB_ENV
- name: Upload built mod JAR
uses: actions/upload-artifact@v4
with:
path: ${{ env.JAR_FILE }}
- name: Create a new release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.run_number }}
- name: Upload the jar to the release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "v${{ github.run_number }}" build/libs/*.jar --clobber