Repository navigation
82 lines (71 loc) · 3.29 KB
/
Copy pathgenerate-definitions.yml
File metadata and controls
82 lines (71 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Generate TypeScript Definitions
# LiquidBounce's release workflow dispatches this with the version it just published.
on:
release:
types: [published]
workflow_dispatch:
inputs:
liquidbounce:
description: 'LiquidBounce version to generate against, e.g. 0.41.0+26.3 (default: the one in libs.versions.toml)'
required: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 75
steps:
- name: Checkout Repository
uses: actions/checkout@v7
- name: Set up JDK
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: '25'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Resolve LiquidBounce version
id: version
env:
INPUT: ${{ inputs.liquidbounce }}
run: |
set -euo pipefail
VERSION="${INPUT:-$(sed -n 's/^liquidbounce = "\(.*\)"$/\1/p' gradle/libs.versions.toml)}"
echo "liquidbounce=$VERSION" >> "$GITHUB_OUTPUT"
# Snapshots are versioned by date, so they must not become `latest`.
if [[ "$VERSION" == *-SNAPSHOT ]]; then echo "tag=next" >> "$GITHUB_OUTPUT"; else echo "tag=latest" >> "$GITHUB_OUTPUT"; fi
- name: Download ts-generator
run: |
mkdir -p run/LiquidBounce/scripts
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/CCBlueX/ts-generator/releases/latest | jq -r '.assets[] | select(.name | endswith(".zip")) | .browser_download_url')
curl -L $LATEST_RELEASE_URL -o run/LiquidBounce/scripts/ts-generator.zip
unzip run/LiquidBounce/scripts/ts-generator.zip -d run/LiquidBounce/scripts/
# Look specifically for the main jar file (excluding source jars)
find run/LiquidBounce/scripts/ -name "*.jar" -not -name "*-sources.jar" -not -name "*-src.jar" -exec mv {} run/LiquidBounce/scripts/ts-generator.jar \; || echo "Main JAR file not found in the zip, check contents"
- name: Copy ts-defgen.js to LiquidBounce scripts
run: |
cp ts-defgen.js run/LiquidBounce/scripts/
# The game renders through Mesa's EGL
- name: Install Xvfb and EGL
run: sudo apt-get update && sudo apt-get install -y xvfb libegl1 libegl-mesa0
- name: Run LiquidBounce with Gradle
env:
SCRIPT_TYPEGEN_BUILD: "true" # Set the CI_BUILD flag to auto-execute ts-defgen
LB_BROWSER_SKIP: "true"
LB_INTEROP_SKIP: "true"
# Minecraft asks for an sRGB framebuffer, which Xvfb's GLX does not offer
SDL_VIDEO_FORCE_EGL: 1
run: |
chmod +x ./gradlew
timeout 60m xvfb-run -a -s "-screen 0 1280x720x24" ./gradlew runClient -Pliquidbounce=${{ steps.version.outputs.liquidbounce }} || exit 0
- name: Upload TypeScript Definitions
uses: actions/upload-artifact@v7
with:
name: 'liquidbounce-script-api'
path: run/LiquidBounce/scripts/@ccbluex/liquidbounce-script-api/
if-no-files-found: error
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v4
with:
token: ${{ secrets.NPM_TOKEN }}
package: run/LiquidBounce/scripts/@ccbluex/liquidbounce-script-api/package.json
access: public
tag: ${{ steps.version.outputs.tag }}