Skip to content

Commit 685d589

Browse files
committed
ci: improve cache restore/update
1 parent 74768b8 commit 685d589

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ jobs:
8383
may_create_release: false
8484
experimental: false
8585

86-
8786
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
8887
concurrency:
8988
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.maven_version }}
@@ -147,17 +146,17 @@ jobs:
147146
!~/.m2/repository/.meta
148147
!~/.m2/repository/com/vegardit/maven
149148
!~/.m2/repository/*SNAPSHOT*
150-
key: ${{ runner.os }}-${{ runner.arch }}-mvn-repo-${{ hashFiles('**/pom.xml') }}
149+
key: ${{ runner.os }}-${{ runner.arch }}-mvn-repo-${{ matrix.maven_version }}-${{ hashFiles('**/pom.xml') }}
151150
restore-keys: |
152151
${{ runner.os }}-${{ runner.arch }}-mvn-repo-
153152
154153
155154
- name: "Move Restored Repo"
156155
if: ${{ steps.cache-restore.outputs.cache-hit }}
157156
run: |
158-
RESTORED_REPO_PATH=$HOME/.m2/repository-restored
159-
mv -v ~/.m2/repository $RESTORED_REPO_PATH
160-
echo "RESTORED_REPO_PATH=$RESTORED_REPO_PATH" >> $GITHUB_ENV
157+
RESTORED_REPO_PATH=$HOME/.m2/repository-restored
158+
mv -v ~/.m2/repository $RESTORED_REPO_PATH
159+
echo "RESTORED_REPO_PATH=$RESTORED_REPO_PATH" >> $GITHUB_ENV
161160
162161
- name: Set Maven version [${{ matrix.maven_version }}]
163162
run: |
@@ -206,6 +205,7 @@ jobs:
206205
207206
- name: "Cache: Update"
208207
uses: actions/cache/save@v4 # https://github.com/actions/cache/blob/main/save/README.md
208+
if: ${{ always() && !cancelled() }} # save the cache even when the build failed
209209
with:
210210
path: |
211211
~/.m2/bin

0 commit comments

Comments
 (0)