diff --git a/bundler.js b/bundler.js index 3d39290..c418c0d 100644 --- a/bundler.js +++ b/bundler.js @@ -232,8 +232,14 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer } async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) { - const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` - let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}` + const cwd = process.cwd() + const bundleWith = process.env['BUNDLE_WITH'] || '' + const bundleWithout = process.env['BUNDLE_WITHOUT'] || '' + let key = `setup-ruby-bundler-cache-v5-${platform}-${engine}-${version}-wd-${cwd}-with-${bundleWith}-without-${bundleWithout}` + + if (cacheVersion !== DEFAULT_CACHE_VERSION) { + key += `-v-${cacheVersion}` + } if (common.isHeadVersion(version)) { if (engine !== 'jruby') { diff --git a/dist/index.js b/dist/index.js index ba17f86..565477e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -246,8 +246,14 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b } async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) { - const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` - let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}` + const cwd = process.cwd() + const bundleWith = process.env['BUNDLE_WITH'] || '' + const bundleWithout = process.env['BUNDLE_WITHOUT'] || '' + let key = `setup-ruby-bundler-cache-v5-${platform}-${engine}-${version}-wd-${cwd}-with-${bundleWith}-without-${bundleWithout}` + + if (cacheVersion !== DEFAULT_CACHE_VERSION) { + key += `-v-${cacheVersion}` + } if (common.isHeadVersion(version)) { if (engine !== 'jruby') {