Merge branch '1.21' #170
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: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
- "!master" | |
jobs: | |
build: | |
name: "Build project" | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Parse gradle properties" | |
id: gradle-properties | |
run: | | |
while IFS='=' read -r key value; do | |
key=$(echo $key | awk '{$1=$1;print}') | |
value=$(echo $value | awk '{$1=$1;print}') | |
case "$key" in | |
minecraft_version) echo "MINECRAFT_VERSION=$value" >> $GITHUB_OUTPUT ;; | |
mod_name) echo "MOD_NAME=$value" >> $GITHUB_OUTPUT ;; | |
mod_version) echo "MOD_VERSION=$value" >> $GITHUB_OUTPUT ;; | |
enabled_platforms) echo "ENABLED_PLATFORMS=$value" >> $GITHUB_OUTPUT ;; | |
esac | |
done < gradle.properties | |
- name: "Set up JDK 17" | |
if: steps.gradle-properties.outputs.MINECRAFT_VERSION != '1.20.6' && steps.gradle-properties.outputs.MINECRAFT_VERSION != '1.21' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: "Set up JDK 21" | |
if: steps.gradle-properties.outputs.MINECRAFT_VERSION == '1.20.6' || steps.gradle-properties.outputs.MINECRAFT_VERSION == '1.21' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: "Run gradle build" | |
uses: gradle/gradle-build-action@v3 | |
with: | |
generate-job-summary: false | |
gradle-version: wrapper | |
arguments: build | |
- name: "Generate matrix for the run job" | |
id: set-matrix | |
run: ./.github/scripts/generate-run-matrix.sh | |
run: | |
name: Run ${{ matrix.mod_loader }} ${{ matrix.script }} | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.build.outputs.matrix)}} | |
timeout-minutes: 15 | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Set up JDK 17" | |
if: matrix.mod_loader.version != '1.20.6' && matrix.mod_loader.version != '1.21' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: "Set up JDK 21" | |
if: matrix.version == '1.20.6' || matrix.version == '1.21' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: "Setup Gradle and run build" | |
uses: gradle/gradle-build-action@v3 | |
with: | |
cache-read-only: true | |
gradle-version: wrapper | |
arguments: ${{ matrix.mod_loader }}:build | |
- name: "Accept eula" | |
run: mkdir -p ${{ matrix.mod_loader }}/run && echo "eula=true" > ${{ matrix.mod_loader }}/run/eula.txt | |
- name: Run ${{ matrix.mod_loader }} ${{ matrix.script }} | |
uses: modmuss50/xvfb-action@v1 | |
with: | |
run: ./.github/scripts/run-${{ matrix.script }}.sh ${{ matrix.mod_loader }} | |
shell: bash |