Merge branch 'main' into 1.20.6 #8
Workflow file for this run
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: Run MC | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dir: | ||
description: 'The directory to build in' | ||
required: true | ||
default: '1_20' | ||
mc: | ||
description: 'The MC version to build' | ||
required: true | ||
default: '1.20.4' | ||
type: | ||
description: 'The type to of jar to use (lexforge, neoforge or fabric)' | ||
required: true | ||
default: 'lexforge' | ||
modloader: | ||
description: 'The modloader to install with HeadlessMc (forge, neoforge or fabric)' | ||
required: true | ||
default: 'forge' | ||
regex: | ||
description: 'Regex to match the MC version to launch (forge is like 1.20.4-forge and fabric starts with fabric-1.20)' | ||
required: true | ||
default: 'fabric.*1.20.4' | ||
java: | ||
description: 'The Java version to use' | ||
required: true | ||
default: '17' | ||
java-distribution: | ||
description: 'The Java distribution to use' | ||
required: false | ||
default: 'adopt' | ||
xvfb: | ||
description: 'Runs the game with Xvfb, if false, you should probably use the -lwjgl option in headlessmc.' | ||
required: false | ||
default: 'true' | ||
type: string | ||
headlessmc-command: | ||
description: 'Arguments for the headlessmc command.' | ||
required: false | ||
default: '--jvm -Djava.awt.headless=true' | ||
type: string | ||
download-hmc: | ||
description: 'Whether to download headlessmc or not, if not you need to provide a file called headlessmc-launcher.jar.' | ||
required: false | ||
default: 'true' | ||
type: string | ||
hmc-version: | ||
description: 'The version of headlessmc to download.' | ||
required: false | ||
default: '1.10.2' | ||
type: string | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ github.event.inputs.java }} | ||
distribution: ${{ github.event.inputs.java-distribution }} | ||
- name: Grant execute permission for gradlew | ||
working-directory: ./${{ github.event.inputs.dir }} | ||
run: chmod +x gradlew | ||
- name: Setup HeadlessMC directory | ||
run: mkdir HeadlessMC | ||
- name: Configure HeadlessMC java versions | ||
run: echo hmc.java.versions=$JAVA_HOME/bin/java > HeadlessMC/config.properties | ||
- name: Configure HeadlessMC game directory | ||
run: echo hmc.gamedir=$PWD/run >> HeadlessMC/config.properties | ||
- name: Configure offline mode | ||
run: echo hmc.offline=true >> HeadlessMC/config.properties | ||
- name: Configure Exceptions | ||
run: echo hmc.rethrow.launch.exceptions=true >> HeadlessMC/config.properties | ||
- name: Configure Failing on wrong command | ||
run: echo hmc.exit.on.failed.command=true >> HeadlessMC/config.properties | ||
- name: Configure Dummy Assets | ||
run: echo hmc.assets.dummy=true >> HeadlessMC/config.properties | ||
- name: Get HeadlessMC | ||
if: ${{ github.event.inputs.download-hmc == 'true' }} | ||
run: wget -O headlessmc-launcher.jar https://github.com/3arthqu4ke/headlessmc/releases/download/${{ github.event.inputs.hmc-version }}/headlessmc-launcher-${{ github.event.inputs.hmc-version }}.jar | ||
- name: Download ${{ github.event.inputs.mc }} | ||
run: java -jar headlessmc-launcher.jar --command download ${{ github.event.inputs.mc }} | ||
- name: Download ${{ github.event.inputs.modloader }} ${{ github.event.inputs.mc }} | ||
run: java -jar headlessmc-launcher.jar --command ${{ github.event.inputs.modloader }} ${{ github.event.inputs.mc }} --java ${{ github.event.inputs.java }} | ||
- name: List versions | ||
run: java -jar headlessmc-launcher.jar --command versions | ||
- name: Make mods dir | ||
run: mkdir -p run/mods | ||
- name: Configure Accessibility | ||
run: echo onboardAccessibility:false >> run/options.txt | ||
- name: Build | ||
working-directory: ./${{ github.event.inputs.dir }} | ||
run: ./gradlew build | ||
- name: Copy mod | ||
run: cp ${{ github.event.inputs.dir }}/build/libs/mc-runtime-test-*-${{ github.event.inputs.type }}-release.jar run/mods | ||
- name: LS mods dir | ||
run: ls run/mods | ||
- name: Run game with xvfb | ||
uses: modmuss50/xvfb-action@v1 | ||
if: ${{ github.event.inputs.xvfb == 'true' }} | ||
with: | ||
run: java -jar headlessmc-launcher.jar --command launch ${{ github.event.inputs.regex }} -regex ${{ github.event.inputs.headlessmc-command }} | ||
- name: Run game | ||
if: ${{ github.event.inputs.xvfb != 'true' }} | ||
run: java -jar headlessmc-launcher.jar --command launch ${{ github.event.inputs.regex }} -regex ${{ github.event.inputs.headlessmc-command }} | ||
shell: bash | ||