Skip to content

chore: port to minecraft 26.3 #14

chore: port to minecraft 26.3

chore: port to minecraft 26.3 #14

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setting up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Build
run: ./gradlew build
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: liquidbounce-scriptapi
path: build/libs/*.jar
- name: Publish snapshot release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
JAR=$(find build/libs -name '*.jar' -not -name '*-sources.jar' | head -n1)
[ -n "$JAR" ] || { echo "[ERROR] no jar in build/libs" >&2; exit 1; }
NOTES="Automatic build of \`${GITHUB_SHA::7}\` from \`main\`.
Not a stable release - it tracks whatever is on main right now."
# Recreate rather than edit: `gh release upload --clobber` cannot retarget the tag when
# main has moved on.
gh release delete snapshot --cleanup-tag --yes || true
gh release create snapshot "$JAR" \
--title "Snapshot" \
--notes "$NOTES" \
--prerelease \
--target "$GITHUB_SHA"
- name: Attach jar to release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
JAR=$(find build/libs -name '*.jar' -not -name '*-sources.jar' | head -n1)
[ -n "$JAR" ] || { echo "[ERROR] no jar in build/libs" >&2; exit 1; }
# The tag names the version the jar was built as, e.g. v1.0.0+26.3
TAG="${{ github.event.release.tag_name }}"
case "$JAR" in
*"-${TAG#v}.jar") ;;
*) echo "[ERROR] $JAR does not match the tag $TAG, check mod_version and minecraft" >&2; exit 1 ;;
esac
gh release upload "$TAG" "$JAR" --clobber
- name: Publish to the marketplace
if: github.event_name == 'release' && !github.event.release.prerelease && vars.MARKETPLACE_ITEM_ID != ''
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ITEM_ID: ${{ vars.MARKETPLACE_ITEM_ID }}
VERSION: ${{ github.event.release.tag_name }}
CHANGELOG: ${{ github.event.release.body }}
run: |
set -euo pipefail
JAR=$(find build/libs -name '*.jar' -not -name '*-sources.jar' | head -n1)
[ -n "$JAR" ] || { echo "[ERROR] no jar in build/libs" >&2; exit 1; }
# The client unpacks a revision and expects exactly one jar at its root.
zip -j addon.zip "$JAR"
# --form-string: -F would read a release body starting with @ as a file path.
curl --fail-with-body -X POST \
"https://api.liquidbounce.net/api/v3/marketplace/$ITEM_ID/revisions" \
-H "Authorization: Bearer $API_TOKEN" \
-F "file=@addon.zip" \
--form-string "version=$VERSION" \
--form-string "changelog=$CHANGELOG"
gametest:
runs-on: ubuntu-latest
# A client that fails to start or hangs must not hold the runner for hours
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setting up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
# The game renders through Mesa's EGL, and the client's browser probes EGL as well.
- name: Install Xvfb and EGL
run: sudo apt-get update && sudo apt-get install -y xvfb libegl1 libegl-mesa0
- name: Run game tests
env:
# Minecraft asks for an sRGB framebuffer, which Xvfb's GLX does not offer
SDL_VIDEO_FORCE_EGL: 1
run: xvfb-run -a -s "-screen 0 1280x720x24" ./gradlew runClientGameTest
- name: Upload game test results
if: always()
uses: actions/upload-artifact@v7
with:
name: gametest
path: |
build/run/clientGameTest/scriptapi-gametest.json
build/run/clientGameTest/screenshots/
build/run/clientGameTest/logs/latest.log
if-no-files-found: ignore