Final Workflow Fix #536
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| cache: gradle | |
| - name: Download Baritone API dependency | |
| run: | | |
| mkdir -p libs | |
| curl -L -o libs/baritone-api-fabric-1.15.0.jar \ | |
| https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-fabric-1.15.0.jar | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build | |
| run: ./gradlew build | |
| - name: Pick main mod jar | |
| id: jar | |
| shell: bash | |
| run: | | |
| # Choose the primary jar (ignore common extra jars) | |
| JAR="$(ls -1 build/libs/*.jar \ | |
| | grep -Ev '(-sources|-javadoc|-dev|-shadow|-all)\.jar$' \ | |
| | head -n 1)" | |
| if [ -z "$JAR" ]; then | |
| echo "No suitable jar found in build/libs/" | |
| ls -la build/libs || true | |
| exit 1 | |
| fi | |
| BASENAME="$(basename "$JAR" .jar)" | |
| echo "jar_path=$JAR" >> "$GITHUB_OUTPUT" | |
| echo "artifact_name=$BASENAME" >> "$GITHUB_OUTPUT" | |
| - name: Upload mod jar (named like the jar) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.jar.outputs.artifact_name }} | |
| path: ${{ steps.jar.outputs.jar_path }} |