create ci #1
This file contains 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 | |
on: [pull_request, push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
java: [ | |
21 # Minimum supported by Minecraft | |
] | |
os: [ubuntu-20.04, windows-latest] | |
mod_loader: [fabric, forge, neoforge] # Add loaders to matrix | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Setup JDK ${{ matrix.java }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Make gradle wrapper executable (Linux only) | |
if: ${{ runner.os != 'Windows' }} | |
run: chmod +x ./gradlew | |
- name: Build Common Module | |
run: ./gradlew :common:build | |
# Build for specific mod loader based on matrix | |
- name: Build ${{ matrix.mod_loader }} Loader | |
run: ./gradlew :${{ matrix.mod_loader }}:build | |
- name: Capture Build Artifacts | |
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only on Linux and latest Java | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-${{ matrix.mod_loader }} | |
path: ${{ matrix.mod_loader }}/build/libs/ |