Explorar el Código

Updating GitHub Actions workflow for Java

RedstoneFuture hace 1 semana
padre
commit
b2f05dff5c
Se han modificado 1 ficheros con 18 adiciones y 12 borrados
  1. 18 12
      .github/workflows/java-ci.yaml

+ 18 - 12
.github/workflows/java-ci.yaml

@@ -1,25 +1,31 @@
 name: Java CI
 
 on:
-  pull_request:
   push:
+    branches: [master]         # Trigger the workflow when pushing to the master branch
+  pull_request:
+    branches: [master]         # Trigger the workflow for pull requests targeting the master branch
 
 jobs:
   build:
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-latest     # Use the latest available Ubuntu runner
 
     steps:
-      - uses: actions/checkout@v3
+      - name: Checkout Repository
+        uses: actions/checkout@v4  # Check out the source code from the repository
+
       - name: Set up JDK 17
-        uses: actions/setup-java@v3
+        uses: actions/setup-java@v4  # Set up the Java Development Kit
         with:
-          java-version: '17'
-          distribution: 'adopt'
-          cache: 'maven'
+          java-version: '17'         # Specify Java version 17
+          distribution: 'temurin'    # Use Temurin distribution (successor to AdoptOpenJDK)
+          cache: 'maven'             # Enable Maven dependency caching for faster builds
+
       - name: Build with Maven
-        run: mvn --batch-mode --update-snapshots package
-      - name: Archive artifacts
-        uses: actions/upload-artifact@v3
+        run: mvn --batch-mode --update-snapshots package  # Compile the project and create the JAR
+
+      - name: Upload JAR Artifact
+        uses: actions/upload-artifact@v4  # Upload the built JAR file as a workflow artifact
         with:
-          name: MissileWars jar
-          path: missilewars-plugin/target/MissileWars-*.jar
+          name: missilewars-jar           # Name of the uploaded artifact
+          path: missilewars-plugin/target/MissileWars-*.jar  # Path to the JAR file(s) to upload