diff --git a/bundler.js b/bundler.js index 7b03241..b5a8a49 100644 --- a/bundler.js +++ b/bundler.js @@ -183,18 +183,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}` - if (engine === 'ruby' && common.isHeadVersion(version)) { - // CRuby dev versions do not change the ABI version when the ABI changes, so append the commit to the ABI version - let revision = ''; - await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], { - silent: true, - listeners: { - stdout: (data) => { - revision += data.toString(); + if (common.isHeadVersion(version)) { + if (engine !== 'jruby') { + // CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version + let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']" + let abi = '' + await exec.exec('ruby', ['-e', print_abi], { + silent: true, + listeners: { + stdout: (data) => { + abi += data.toString(); + } } - } - }); - key += `-revision-${revision}` + }); + key += `-ABI-${abi}` + } } key += `-${lockFile}` diff --git a/dist/index.js b/dist/index.js index b48bce9..95ec40b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -197,18 +197,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}` - if (engine === 'ruby' && common.isHeadVersion(version)) { - // CRuby dev versions do not change the ABI version when the ABI changes, so append the commit to the ABI version - let revision = ''; - await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], { - silent: true, - listeners: { - stdout: (data) => { - revision += data.toString(); + if (common.isHeadVersion(version)) { + if (engine !== 'jruby') { + // CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version + let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']" + let abi = '' + await exec.exec('ruby', ['-e', print_abi], { + silent: true, + listeners: { + stdout: (data) => { + abi += data.toString(); + } } - } - }); - key += `-revision-${revision}` + }); + key += `-ABI-${abi}` + } } key += `-${lockFile}`