mirror of https://github.com/LOOHP/Limbo.git
Update build-and-release.yml
This commit is contained in:
parent
c755000b98
commit
50ece6e665
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build Limbo and Add-ons
|
name: Build Limbo Project and Add-ons
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -17,83 +17,96 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout source
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up default JDK (21 fallback)
|
- name: Set up fallback JDK 21
|
||||||
id: java
|
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 21
|
java-version: 21
|
||||||
|
|
||||||
- name: Install `javap` dependencies
|
- name: Install javap tools
|
||||||
run: sudo apt-get update && sudo apt-get install -y openjdk-21-jdk
|
run: sudo apt-get update && sudo apt-get install -y openjdk-21-jdk
|
||||||
|
|
||||||
- name: Function to detect class version
|
- name: Create Maven settings (skip checksum validation)
|
||||||
|
run: |
|
||||||
|
mkdir -p .mvn
|
||||||
|
cat > .mvn/settings.xml <<EOF
|
||||||
|
<settings>
|
||||||
|
<mirrors>
|
||||||
|
<mirror>
|
||||||
|
<id>central</id>
|
||||||
|
<name>Maven Central</name>
|
||||||
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
|
<mirrorOf>central</mirrorOf>
|
||||||
|
</mirror>
|
||||||
|
</mirrors>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>no-checksums</id>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
<activeProfiles>
|
||||||
|
<activeProfile>no-checksums</activeProfile>
|
||||||
|
</activeProfiles>
|
||||||
|
</settings>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Clone ViaLimbo
|
||||||
|
run: git clone https://github.com/LOOHP/ViaLimbo.git external/ViaLimbo
|
||||||
|
|
||||||
|
- name: Resolve ViaLimbo dependencies
|
||||||
|
run: mvn -f external/ViaLimbo/pom.xml dependency:resolve -s .mvn/settings.xml || true
|
||||||
|
|
||||||
|
- name: Detect Java version from class
|
||||||
id: detect-java
|
id: detect-java
|
||||||
run: |
|
run: |
|
||||||
find_external_class_version() {
|
CLASS_FILE=$(find external/ViaLimbo -name "*.class" | head -n 1)
|
||||||
class_file=$(find "$1" -name "*.class" | head -n 1)
|
if [[ -f "$CLASS_FILE" ]]; then
|
||||||
if [[ -f "$class_file" ]]; then
|
MAJOR=$(javap -verbose "$CLASS_FILE" | grep "major version" | awk '{print $3}')
|
||||||
version=$(javap -verbose "$class_file" | grep "major version" | awk '{print $3}')
|
echo "Detected major version: $MAJOR"
|
||||||
echo "Detected major version: $version"
|
if [[ "$MAJOR" -eq 61 ]]; then
|
||||||
|
echo "java_version=17" >> $GITHUB_OUTPUT
|
||||||
# Map to Java version
|
elif [[ "$MAJOR" -eq 65 ]]; then
|
||||||
if [[ "$version" == "61" ]]; then
|
echo "java_version=21" >> $GITHUB_OUTPUT
|
||||||
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
|
else
|
||||||
echo "No .class file found, defaulting to JDK 21"
|
echo "java_version=21" >> $GITHUB_OUTPUT
|
||||||
echo "java_version=21" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
fi
|
||||||
}
|
else
|
||||||
|
echo "java_version=21" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
# Clone and check ViaLimbo first
|
- name: Setup Java for ViaLimbo
|
||||||
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
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: ${{ steps.detect-java.outputs.java_version }}
|
java-version: ${{ steps.detect-java.outputs.java_version }}
|
||||||
|
|
||||||
- name: Build ViaLimbo (optional)
|
- name: Build ViaLimbo
|
||||||
run: |
|
run: |
|
||||||
cd external/ViaLimbo
|
cd external/ViaLimbo
|
||||||
mvn package -DskipTests || echo "::warning::ViaLimbo build failed"
|
mvn package -DskipTests -s ../../.mvn/settings.xml || echo "::warning::ViaLimbo build failed"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Build FloodgateLimbo (optional)
|
- name: Clone and Build Floodgate-Limbo
|
||||||
run: |
|
run: |
|
||||||
git clone https://github.com/LOOHP/floodgate-limbo.git external/FloodgateLimbo
|
git clone https://github.com/LOOHP/floodgate-limbo.git external/FloodgateLimbo
|
||||||
cd external/FloodgateLimbo
|
cd external/FloodgateLimbo
|
||||||
mvn package -DskipTests || echo "::warning::FloodgateLimbo build failed"
|
mvn package -DskipTests -s ../../.mvn/settings.xml || echo "::warning::FloodgateLimbo build failed"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Set up Java for main project (from pom.xml or fallback)
|
- name: Set up JDK 21 for main project
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 21
|
java-version: 21
|
||||||
|
|
||||||
- name: Build your main project
|
- name: Build Main Project
|
||||||
run: mvn package -DskipTests || echo "::warning::Main project build failed"
|
run: mvn package -DskipTests -s .mvn/settings.xml || echo "::warning::Main project build failed"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release (if tagged)
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue