keycloak-scim/.github/actions/maven-cache/action.yml
Alexander Schwartz 4bfa3c7a1a
Avoid caching of Keycloak artifacts (#17465)
Also, only create the cache on build, not when running the tests

Closes #17461
2023-03-07 11:44:49 +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@v3
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@v3
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@v3
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-