name: Java CI with Gradle

on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]

jobs:
  build:
    runs-on: archlinux-latest

    steps:
      - name: Install prerequisite packages
        run: pacman -Syu --noconfirm && pacman -S --noconfirm git nodejs

      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up JDK 21
        uses: actions/setup-java@v4
        with:
          java-version: "21"
          distribution: "temurin"

      - name: Setup Gradle
        uses: gradle/actions/setup-gradle@v4

      - name: Build with Gradle Wrapper
        run: ./gradlew build

      - name: Upload build artifacts
        uses: actions/upload-artifact@v4
        with:
          name: JARs
          path: build/libs
          retention-days: 30
          compression-level: 9
