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:
|
||||
push:
|
||||
|
|
@ -17,83 +17,96 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up default JDK (21 fallback)
|
||||
id: java
|
||||
- name: Set up fallback JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- name: Install `javap` dependencies
|
||||
- name: Install javap tools
|
||||
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
|
||||
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"
|
||||
CLASS_FILE=$(find external/ViaLimbo -name "*.class" | head -n 1)
|
||||
if [[ -f "$CLASS_FILE" ]]; then
|
||||
MAJOR=$(javap -verbose "$CLASS_FILE" | grep "major version" | awk '{print $3}')
|
||||
echo "Detected major version: $MAJOR"
|
||||
if [[ "$MAJOR" -eq 61 ]]; then
|
||||
echo "java_version=17" >> $GITHUB_OUTPUT
|
||||
elif [[ "$MAJOR" -eq 65 ]]; then
|
||||
echo "java_version=21" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Unknown version. Falling back to 21"
|
||||
echo "java_version=21" >> "$GITHUB_OUTPUT"
|
||||
echo "java_version=21" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
else
|
||||
echo "No .class file found, defaulting to JDK 21"
|
||||
echo "java_version=21" >> "$GITHUB_OUTPUT"
|
||||
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
|
||||
- name: Setup Java for ViaLimbo
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: ${{ steps.detect-java.outputs.java_version }}
|
||||
|
||||
- name: Build ViaLimbo (optional)
|
||||
- name: Build ViaLimbo
|
||||
run: |
|
||||
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
|
||||
|
||||
- name: Build FloodgateLimbo (optional)
|
||||
- name: Clone and Build Floodgate-Limbo
|
||||
run: |
|
||||
git clone https://github.com/LOOHP/floodgate-limbo.git 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
|
||||
|
||||
- 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
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- name: Build your main project
|
||||
run: mvn package -DskipTests || echo "::warning::Main project build failed"
|
||||
- name: Build Main Project
|
||||
run: mvn package -DskipTests -s .mvn/settings.xml || echo "::warning::Main project build failed"
|
||||
continue-on-error: true
|
||||
|
||||
- name: Create GitHub Release
|
||||
- name: Create GitHub Release (if tagged)
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
|
|
|
|||
Loading…
Reference in New Issue