mirror of
https://github.com/gradle/actions.git
synced 2026-04-19 18:12:58 +08:00
Fix legacy caching module distribution for CI
The legacy caching bundle at sources/legacy-caching/dist/ was gitignored by sources/.gitignore, so CI never included it. Fix by: - Copying the bundle into sources/dist/legacy-caching/ during build - Updating the loader path to resolve from dist/legacy-caching/ - Adding legacy module build steps to build-dist action and ci-update-dist workflow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,13 @@ runs:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
- name: Build legacy caching module
|
||||
shell: bash
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
working-directory: sources/legacy-caching
|
||||
|
||||
- name: Build distribution
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -20,6 +27,8 @@ runs:
|
||||
- name: Copy the generated sources/dist directory to the top-level dist
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p sources/dist/legacy-caching
|
||||
cp sources/legacy-caching/dist/index.js sources/dist/legacy-caching/
|
||||
cp -r sources/dist .
|
||||
|
||||
- name: Upload distribution
|
||||
|
||||
@@ -38,6 +38,12 @@ jobs:
|
||||
run: |
|
||||
npm exec -y -- pacote extract @gradle-tech/develocity-agent@3.0.1 ~/.node_libraries/@gradle-tech/develocity-agent
|
||||
|
||||
- name: Build legacy caching module
|
||||
run: |
|
||||
npm clean-install
|
||||
npm run build
|
||||
working-directory: sources/legacy-caching
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: |
|
||||
npm clean-install
|
||||
@@ -58,6 +64,8 @@ jobs:
|
||||
|
||||
- name: Copy the generated sources/dist directory to the top-level dist
|
||||
run: |
|
||||
mkdir -p sources/dist/legacy-caching
|
||||
cp sources/legacy-caching/dist/index.js sources/dist/legacy-caching/
|
||||
cp -r sources/dist .
|
||||
|
||||
- name: Import GPG key to sign commits
|
||||
|
||||
@@ -6,6 +6,9 @@ build_legacy_caching() {
|
||||
npm clean-install
|
||||
npm run build
|
||||
cd ../..
|
||||
# Copy legacy caching bundle into sources/dist so the CI bot picks it up
|
||||
mkdir -p sources/dist/legacy-caching
|
||||
cp sources/legacy-caching/dist/index.js sources/dist/legacy-caching/
|
||||
}
|
||||
|
||||
cd sources
|
||||
|
||||
@@ -90,16 +90,6 @@ export function findGradleExecutableForCleanup(buildResults: BuildResults): stri
|
||||
}
|
||||
}
|
||||
|
||||
// Try the Gradle installation directory as a fallback
|
||||
for (const result of buildResults.results) {
|
||||
if (versionIsAtLeast(result.gradleVersion, '8.11')) {
|
||||
const executable = path.resolve(result.gradleHomeDir, 'bin', IS_WINDOWS ? 'gradle.bat' : 'gradle')
|
||||
if (fs.existsSync(executable)) {
|
||||
return executable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.info('Could not locate a Gradle >= 8.11 executable for cache cleanup.')
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export async function loadVendoredCacheService(): Promise<CacheService> {
|
||||
}
|
||||
|
||||
export async function loadLegacyCacheService(): Promise<CacheService> {
|
||||
const legacyLibraryPath = findLibraryPath('sources/legacy-caching/dist/index.js')
|
||||
const legacyLibraryPath = findLibraryPath('dist/legacy-caching/index.js')
|
||||
const moduleUrl = pathToFileURL(legacyLibraryPath).href
|
||||
return (await import(moduleUrl)) as CacheService
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user