name: Auto Build Spigot
on:
  workflow_dispatch:

jobs:
  build-spigot:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout workspace
        uses: actions/checkout@v4

      # JAVA版本
      - name: Setup JDK 
        uses: actions/setup-java@v4
        with:
          java-version: '8'
          distribution: 'temurin'


      - name: Download BuildTools.jar
        run: wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

      # Minecraft版本
      - name: Compile Spigot Core
        run: java -jar BuildTools.jar --rev 1.8.8


      - name: Upload Spigot Artifact
        uses: actions/upload-artifact@v4
        with:
          name: spigot
          path: '**/spigot-*.jar'
