keycloak-scim/.github/actions/maven-cache/action.yml
Stian Thorgersen 2672b362c9
Update github action versions (#27692)
Signed-off-by: stianst <stianst@gmail.com>
2024-03-22 08:57:41 +01:00

51 lines
No EOL
1.8 KiB
YAML

name: Maven Cache
description: Caches Maven artifacts
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
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
uses: actions/cache@v4
if: inputs.create-cache-if-it-doesnt-exist == 'true'
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 }}
- id: restore-maven-repository
name: Maven cache
uses: actions/cache/restore@v4
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 }}
- name: Cache Maven Wrapper
uses: actions/cache@v4
with:
path: .mvn/wrapper/maven-wrapper.jar
key: ${{ runner.os }}-maven-wrapper-${{ hashFiles('**/maven-wrapper.properties') }}
# use a previously cached JAR file as something else besides the version could have changed in the file
restore-keys: |
${{ runner.os }}-maven-wrapper-