Upstream #5
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: Java CI with Gradle | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.2.2 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4.7.0 | |
| with: | |
| distribution: temurin | |
| java-version: 25 | |
| - name: Cache generated data | |
| uses: actions/cache@v5.0.4 | |
| with: | |
| path: | | |
| plugin/build/minecraft/ | |
| plugin/build/generated/minecraft/mapping/ | |
| ~/.gradle/caches/limboapi-minecraft/ | |
| key: minecraft-${{ hashFiles('gradle.properties') }} | |
| - name: Build LimboAPI | |
| run: ./gradlew build | |
| - name: Upload LimboAPI artifact | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: LimboAPI | |
| path: "*/build/libs/*.jar" | |
| - name: Generate release tag | |
| if: ${{ github.event_name == 'push' }} | |
| id: release-tag | |
| run: | | |
| git fetch --tags | |
| LATEST_BUILD=0 | |
| if git tag | grep -E "^build-[0-9]+$" > /dev/null; then | |
| LATEST_BUILD=$(git tag | grep -E "^build-[0-9]+$" | sed 's/build-//' | sort -n | tail -1) | |
| fi | |
| NEW_BUILD=$((LATEST_BUILD + 1)) | |
| echo "tag=build-$NEW_BUILD" >> $GITHUB_OUTPUT | |
| echo "build_nr=$NEW_BUILD" >> $GITHUB_OUTPUT | |
| - name: Find correct JAR | |
| if: ${{ github.event_name == 'push' }} | |
| id: find-jar | |
| run: | | |
| output="$(find plugin/build/libs/ ! -name "*-javadoc.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" | |
| echo "jarname=$output" >> $GITHUB_OUTPUT | |
| - name: Release build | |
| if: ${{ github.event_name == 'push' }} | |
| uses: marvinpinto/action-automatic-releases@master | |
| with: | |
| title: "LimboAPI (Velocity-CTD) build-${{ steps.release-tag.outputs.build_nr }}" | |
| automatic_release_tag: "${{ steps.release-tag.outputs.tag }}" | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| files: plugin/build/libs/${{ steps.find-jar.outputs.jarname }} | |
| prerelease: false |