name: Java CI

on:
  pull_request:
  push:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - name: Set up JDK 17
        uses: actions/setup-java@v3
        with:
          java-version: '17'
          distribution: 'adopt'
          cache: 'maven'
      - name: Build with Maven
        run: mvn --batch-mode --update-snapshots package
      - name: Archive artifacts
        uses: actions/upload-artifact@v3
        with:
          name: MissileWars jar
          path: missilewars-plugin/target/MissileWars-*.jar