2022-12-14 15:12:23 +00:00
|
|
|
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
|
2023-01-20 08:11:38 +00:00
|
|
|
|
|
|
|
- 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-
|