java-ci.yaml 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. name: Java CI
  2. on:
  3. push:
  4. branches: [master] # Trigger the workflow when pushing to the master branch
  5. pull_request:
  6. branches: [master] # Trigger the workflow for pull requests targeting the master branch
  7. jobs:
  8. build:
  9. runs-on: ubuntu-latest # Use the latest available Ubuntu runner
  10. steps:
  11. - name: Checkout Repository
  12. uses: actions/checkout@v4 # Check out the source code from the repository
  13. - name: Set up JDK 17
  14. uses: actions/setup-java@v4 # Set up the Java Development Kit
  15. with:
  16. java-version: '17' # Specify Java version 17
  17. distribution: 'temurin' # Use Temurin distribution (successor to AdoptOpenJDK)
  18. cache: 'maven' # Enable Maven dependency caching for faster builds
  19. - name: Build with Maven
  20. run: mvn --batch-mode --update-snapshots package # Compile the project and create the JAR
  21. - name: Upload JAR Artifact
  22. uses: actions/upload-artifact@v4 # Upload the built JAR file as a workflow artifact
  23. with:
  24. name: missilewars-jar # Name of the uploaded artifact
  25. path: missilewars-plugin/target/MissileWars-*.jar # Path to the JAR file(s) to upload