Skip to content

Commit

Permalink
setup cache before setup java
Browse files Browse the repository at this point in the history
If the cache is set up after we setup java, it will overwrite the m2-settings.xml in the home dir
  • Loading branch information
nicklasl committed Sep 28, 2023
1 parent acbf776 commit 7679a37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java_version }}

- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-java-${{ matrix.java_version }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-java-${{ matrix.java_version }}-m2

- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java_version }}

- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
14 changes: 7 additions & 7 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ jobs:
with:
ref: ${{ needs.release-please.outputs.release_tag_name }}

- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-java-17-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-java-17-m2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -44,13 +51,6 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Full private key blob
gpg-passphrase: ${{ secrets.SIGN_KEY_PASS }} # Password chosen when creating the GPG key

- name: Cache Maven packages
uses: actions/[email protected]
with:
path: ~/.m2
key: ${{ runner.os }}-java-17-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-java-17-m2

- name: Deploy with Maven
run: |
mvn --batch-mode \
Expand Down

0 comments on commit 7679a37

Please sign in to comment.