From 8490fce70fc6182e1b298fe08ec9eda2961c525e Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Thu, 9 Sep 2021 04:49:52 -0700 Subject: [PATCH] Cache local Maven repository via actions/setup-java As of August 30, ["`setup-java` supports caching for both Gradle and Maven projects"](https://github.blog/changelog/2021-08-30-github-actions-setup-java-now-supports-dependency-caching/). This helps to reduce the amount of boilerplate code in the workflow file. More details can be found in the [corresponding docs](https://github.com/actions/setup-java#caching-packages-dependencies). (And if you wonder what's the used cache key format: https://github.com/actions/setup-java/pull/215/) Fixes #660 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/google-java-format/pull/660 from beatngu13:patch-1 47e262b489e0f3ce795413bd10b7fe50a22ca2c6 PiperOrigin-RevId: 395674252 --- .github/workflows/ci.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f4080a67..0386892e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,18 +52,12 @@ jobs: access_token: ${{ github.token }} - name: 'Check out repository' uses: actions/checkout@v2 - - name: 'Cache local Maven repository' - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: 'Set up JDK ${{ matrix.java }}' uses: actions/setup-java@v2 with: java-version: ${{ matrix.java }} distribution: 'zulu' + cache: 'maven' - name: 'Install' shell: bash run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V @@ -79,18 +73,12 @@ jobs: steps: - name: 'Check out repository' uses: actions/checkout@v2 - - name: 'Cache local Maven repository' - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: 'Set up JDK 15' uses: actions/setup-java@v2 with: java-version: 15 distribution: 'zulu' + cache: 'maven' server-id: sonatype-nexus-snapshots server-username: CI_DEPLOY_USERNAME server-password: CI_DEPLOY_PASSWORD