diff --git a/.github/actions/maven-cache/action.yml b/.github/actions/maven-cache/action.yml index dee09fe2dc..8d66ff851e 100644 --- a/.github/actions/maven-cache/action.yml +++ b/.github/actions/maven-cache/action.yml @@ -31,15 +31,6 @@ runs: # Enable cross-os archive use the cache on both Linux and Windows enableCrossOsArchive: true - - id: download-node-for-windows - # This is necessary as the build which creates the cache will run on a Linux node and therefore will never download the Windows artifact by default. - # If we wouldn't download it manually, it would be downloaded on each Windows build, which proved to be unstable as downloads would randomly fail in the middle of the download. - if: inputs.create-cache-if-it-doesnt-exist == 'true' && steps.cache-maven-repository.outputs.cache-hit != 'true' - shell: bash - run: | - export VERSION=$(mvn help:evaluate -Dexpression=node.version -q -DforceStdout | cut -c 2-) - curl -Lf https://nodejs.org/dist/v${VERSION}/win-x64/node.exe --create-dirs -o ~/.m2/repository/com/github/eirslett/node/${VERSION}/node-${VERSION}-win-x64.exe - - 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' @@ -61,4 +52,20 @@ runs: ~/.m2/repository/*/* !~/.m2/repository/org/keycloak key: ${{ steps.weekly-cache-key.outputs.key }} - enableCrossOsArchive: true \ No newline at end of file + enableCrossOsArchive: true + + - name: Get Node.js and PNPM versions + id: tooling-versions + shell: bash + run: | + echo "node=$(mvn help:evaluate -Dexpression=node.version -q -DforceStdout | cut -c 2-)" >> $GITHUB_OUTPUT + echo "pnpm=$(mvn help:evaluate -Dexpression=pnpm.version -q -DforceStdout)" >> $GITHUB_OUTPUT + + # Downloading Node.js often fails due to network issues, therefore we cache the artifacts downloaded by the frontend plugin. + - uses: actions/cache@v4 + name: Cache Node.js related artifacts + with: + path: | + ~/.m2/repository/com/github/eirslett/node + ~/.m2/repository/com/github/eirslett/pnpm + key: ${{ runner.os }}-frontend-plugin-artifacts-${{ steps.tooling-versions.outputs.node }}-${{ steps.tooling-versions.outputs.pnpm }}