2022-12-14 15:12:23 +00:00
|
|
|
name: Maven Cache
|
|
|
|
description: Caches Maven artifacts
|
|
|
|
|
2023-03-07 10:44:49 +00:00
|
|
|
inputs:
|
|
|
|
create-cache-if-it-doesnt-exist:
|
|
|
|
description: >
|
|
|
|
Only those callers which fill the cache with the right contents should set this to true to avoid creating a cache
|
|
|
|
which contains too few or too many entries.
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
|
2022-12-14 15:12:23 +00:00
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- id: weekly-cache-key
|
|
|
|
name: Key for weekly rotation of cache
|
|
|
|
shell: bash
|
|
|
|
run: echo "key=mvn-`date -u "+%Y-%U"`" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- id: cache-maven-repository
|
|
|
|
name: Maven cache
|
2024-03-22 07:57:41 +00:00
|
|
|
uses: actions/cache@v4
|
2023-03-07 10:44:49 +00:00
|
|
|
if: inputs.create-cache-if-it-doesnt-exist == 'true'
|
2022-12-14 15:12:23 +00:00
|
|
|
with:
|
2023-03-07 10:44:49 +00:00
|
|
|
# Two asterisks are needed to make the follow-up exclusion work
|
|
|
|
# see https://github.com/actions/toolkit/issues/713 for the upstream issue
|
|
|
|
path: |
|
|
|
|
~/.m2/repository/*/*
|
|
|
|
!~/.m2/repository/org/keycloak
|
2022-12-14 15:12:23 +00:00
|
|
|
key: ${{ steps.weekly-cache-key.outputs.key }}
|
|
|
|
|
2023-03-07 10:44:49 +00:00
|
|
|
- id: restore-maven-repository
|
|
|
|
name: Maven cache
|
2024-03-22 07:57:41 +00:00
|
|
|
uses: actions/cache/restore@v4
|
2023-03-07 10:44:49 +00:00
|
|
|
if: inputs.create-cache-if-it-doesnt-exist == 'false'
|
|
|
|
with:
|
|
|
|
# Two asterisks are needed to make the follow-up exclusion work
|
|
|
|
# see https://github.com/actions/toolkit/issues/713 for the upstream issue
|
|
|
|
path: |
|
|
|
|
~/.m2/repository/*/*
|
|
|
|
!~/.m2/repository/org/keycloak
|
|
|
|
key: ${{ steps.weekly-cache-key.outputs.key }}
|