keycloak-scim/.github/actions/maven-cache/action.yml
2023-01-20 09:11:38 +01:00

37 lines
No EOL
1.2 KiB
YAML

name: Maven Cache
description: Caches Maven artifacts
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
with:
path: ~/.m2/repository
key: ${{ steps.weekly-cache-key.outputs.key }}
- id: check-maven-cache
name: Check cache has no Keycloak artifacts
if: steps.cache-maven-repository.outputs.cache-hit == 'true'
shell: bash
run: |
if ( stat ~/.m2/repository/org/keycloak &>/dev/null ); then
echo "Found org/keycloak artifacts in Maven repository cache"
ls ~/.m2/repository/org/keycloak
exit 1
fi
- 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-