use branch name in the cache key (#1049)
This commit is contained in:
22
.github/workflows/maven.yaml
vendored
22
.github/workflows/maven.yaml
vendored
@@ -21,13 +21,31 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: Extract branch name
|
||||
id: extract_branch
|
||||
shell: bash
|
||||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF})"
|
||||
|
||||
- name: Cache local Maven repository
|
||||
id: cache-maven-repo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
key: ${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
${{ runner.os }}-maven-${{ steps.extract_branch.outputs.branch }}-${{ hashFiles('**/pom.xml') }}
|
||||
|
||||
- if: ${{ steps.cache-maven-repo.outputs.cache-hit == 'false' }}
|
||||
name: cache miss callback
|
||||
continue-on-error: false
|
||||
run: echo 'cache miss'
|
||||
|
||||
- if: ${{ steps.cache-maven-repo.outputs.cache-hit == 'true' }}
|
||||
name: cache hit callback
|
||||
continue-on-error: false
|
||||
run: echo 'cache hit'
|
||||
|
||||
- name: Build with Maven
|
||||
run: ./mvnw -s .settings.xml clean org.jacoco:jacoco-maven-plugin:prepare-agent install -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
|
||||
- name: Publish Test Report
|
||||
|
||||
Reference in New Issue
Block a user