mirror of https://github.com/LOOHP/Limbo.git
104 lines
3.2 KiB
YAML
104 lines
3.2 KiB
YAML
name: Build Limbo and Add-ons
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '**/README.md'
|
|
- '**/readme.md'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up default JDK (21 fallback)
|
|
id: java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
|
|
- name: Install `javap` dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y openjdk-21-jdk
|
|
|
|
- name: Function to detect class version
|
|
id: detect-java
|
|
run: |
|
|
find_external_class_version() {
|
|
class_file=$(find "$1" -name "*.class" | head -n 1)
|
|
if [[ -f "$class_file" ]]; then
|
|
version=$(javap -verbose "$class_file" | grep "major version" | awk '{print $3}')
|
|
echo "Detected major version: $version"
|
|
|
|
# Map to Java version
|
|
if [[ "$version" == "61" ]]; then
|
|
echo "Detected Java 17"
|
|
echo "java_version=17" >> "$GITHUB_OUTPUT"
|
|
elif [[ "$version" == "65" ]]; then
|
|
echo "Detected Java 21"
|
|
echo "java_version=21" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "Unknown version. Falling back to 21"
|
|
echo "java_version=21" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
else
|
|
echo "No .class file found, defaulting to JDK 21"
|
|
echo "java_version=21" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
}
|
|
|
|
# Clone and check ViaLimbo first
|
|
git clone https://github.com/LOOHP/ViaLimbo.git external/ViaLimbo
|
|
mvn -f external/ViaLimbo/pom.xml dependency:resolve || true
|
|
|
|
# Try detecting version
|
|
find_external_class_version "external/ViaLimbo"
|
|
continue-on-error: true
|
|
|
|
- name: Set up detected JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: ${{ steps.detect-java.outputs.java_version }}
|
|
|
|
- name: Build ViaLimbo (optional)
|
|
run: |
|
|
cd external/ViaLimbo
|
|
mvn package -DskipTests || echo "::warning::ViaLimbo build failed"
|
|
continue-on-error: true
|
|
|
|
- name: Build FloodgateLimbo (optional)
|
|
run: |
|
|
git clone https://github.com/LOOHP/floodgate-limbo.git external/FloodgateLimbo
|
|
cd external/FloodgateLimbo
|
|
mvn package -DskipTests || echo "::warning::FloodgateLimbo build failed"
|
|
continue-on-error: true
|
|
|
|
- name: Set up Java for main project (from pom.xml or fallback)
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
|
|
- name: Build your main project
|
|
run: mvn package -DskipTests || echo "::warning::Main project build failed"
|
|
continue-on-error: true
|
|
|
|
- name: Create GitHub Release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
target/*.jar
|
|
external/ViaLimbo/target/*.jar
|
|
external/FloodgateLimbo/target/*.jar
|