Copy restored maven repo to home folder in Windows

Closes #40593

Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
Ricardo Martin
2025-06-19 12:52:10 +02:00
committed by GitHub
parent 8a5d1a1282
commit 93dc178459
2 changed files with 19 additions and 27 deletions

View File

@@ -31,23 +31,6 @@ runs:
# Enable cross-os archive use the cache on both Linux and Windows
enableCrossOsArchive: true
# There have been recent changes on the build images about C/D drives, see https://github.com/actions/runner-images/issues/12386
# As a temporary measure, disabling this optimization
# This should be revisited to speed up the builds in a future issue
#
# - shell: powershell
# name: Link the cached Maven repository to the OS-dependent location
# if: inputs.create-cache-if-it-doesnt-exist == 'false' && runner.os == 'Windows'
# # The cache restore in the next step uses the relative path which was valid on Linux and that is part of the archive it downloads.
# # You'll see that path when you enable debugging for the GitHub workflow on Windows.
# # On Windows, the .m2 folder is in different location, so move all the contents to the right folder here.
# # Also, not using the C: drive will speed up the build, see https://github.com/actions/runner-images/issues/8755
# run: |
# mkdir -p ..\..\..\.m2
# mkdir -p D:\.m2\repository
# cmd /c mklink /d $HOME\.m2\repository D:\.m2\repository
# cmd /c "rmdir /s /q $PWD\..\..\..\.m2\repository & mklink /d $PWD\..\..\..\.m2\repository D:\.m2\repository"
- id: restore-maven-repository
name: Maven cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
@@ -60,6 +43,15 @@ runs:
key: ${{ steps.weekly-cache-key.outputs.key }}
enableCrossOsArchive: true
- shell: bash
name: Copy restored maven repo to home folder in Windows
if: (steps.cache-maven-repository.outputs.cache-hit == 'true' || steps.restore-maven-repository.outputs.cache-hit == 'true') && runner.os == 'Windows'
run: |
if [ -d ../../../.m2/repository ]; then
cp -r ../../../.m2/repository ~/.m2
rm -r ../../../.m2/repository
fi
- id: node-cache
name: Node cache
uses: ./.github/actions/node-cache