From 4ebfe3e3390e168861a7bacbab28e5f40f9bd8cc Mon Sep 17 00:00:00 2001 From: Gecko! Date: Sat, 2 Dec 2023 20:29:32 +0100 Subject: [PATCH 1/2] Update Maven GitHub workflow The Maven packaging GitHub action workflow has been updated to include caching of dependencies and restructured for clarity. Now, Maven dependencies are cached to improve build speed and a target directory is created before the build. Additionally, the workflow code has been reformatted for better readability. --- .github/workflows/maven-publish.yml | 39 ++++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 6212796..24b6bc2 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -1,6 +1,3 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path - name: Maven Package on: @@ -12,20 +9,32 @@ on: branches: - master - experimental + jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - distribution: 'adopt' - java-version: '8' - - name: Create Target Directory - run: mkdir -p target - - name: Build with Maven - run: mvn package --file ../pom.xml - working-directory: target + - uses: actions/checkout@v3 + + - name: Cache Maven dependencies + uses: actions/cache@v2 + with: + path: | + ~/.m2/repository + key: maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + maven- + + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '8' + + - name: Create Target Directory + run: mkdir -p target + + - name: Build with Maven + run: mvn package --file ../pom.xml + working-directory: target From 6c94ebed89b10f41c13aa5f032f6a6bdece3bf35 Mon Sep 17 00:00:00 2001 From: Gecko! Date: Sat, 2 Dec 2023 20:32:09 +0100 Subject: [PATCH 2/2] Add Node.js setup to Maven GitHub Workflow The GitHub Action workflow for Maven is updated to include a Node.js setup. The workflow now sets up Node.js version 16, to ensure consistency across development environments. This change complements the Maven dependencies caching feature, contributing to increased speed and efficiency in the build process. --- .github/workflows/maven-publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 24b6bc2..3ef4ab5 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -17,6 +17,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 16 + - name: Cache Maven dependencies uses: actions/cache@v2 with: