@@ -2237,10 +2237,9 @@ function createHttpClient() {
22372237 return new http_client_1 . HttpClient ( "actions/cache" , [ bearerCredentialHandler ] , getRequestOptions ( ) ) ;
22382238}
22392239function getCacheVersion ( compressionMethod ) {
2240+ const components = [ core . getInput ( constants_1 . Inputs . Path , { required : true } ) ] . concat ( compressionMethod == constants_1 . CompressionMethod . Zstd ? [ compressionMethod ] : [ ] ) ;
22402241 // Add salt to cache version to support breaking changes in cache entry
2241- const components = [ core . getInput ( constants_1 . Inputs . Path , { required : true } ) ] . concat ( compressionMethod == constants_1 . CompressionMethod . Zstd
2242- ? [ compressionMethod , versionSalt ]
2243- : versionSalt ) ;
2242+ components . push ( versionSalt ) ;
22442243 return crypto
22452244 . createHash ( "sha256" )
22462245 . update ( components . join ( "|" ) )
@@ -3320,7 +3319,7 @@ function unlinkFile(path) {
33203319 return util . promisify ( fs . unlink ) ( path ) ;
33213320}
33223321exports . unlinkFile = unlinkFile ;
3323- function checkVersion ( app ) {
3322+ function getVersion ( app ) {
33243323 return __awaiter ( this , void 0 , void 0 , function * ( ) {
33253324 core . debug ( `Checking ${ app } --version` ) ;
33263325 let versionOutput = "" ;
@@ -3344,7 +3343,7 @@ function checkVersion(app) {
33443343}
33453344function getCompressionMethod ( ) {
33463345 return __awaiter ( this , void 0 , void 0 , function * ( ) {
3347- const versionOutput = yield checkVersion ( "zstd" ) ;
3346+ const versionOutput = yield getVersion ( "zstd" ) ;
33483347 return versionOutput . toLowerCase ( ) . includes ( "zstd command line interface" )
33493348 ? constants_1 . CompressionMethod . Zstd
33503349 : constants_1 . CompressionMethod . Gzip ;
@@ -3359,7 +3358,7 @@ function getCacheFileName(compressionMethod) {
33593358exports . getCacheFileName = getCacheFileName ;
33603359function useGnuTar ( ) {
33613360 return __awaiter ( this , void 0 , void 0 , function * ( ) {
3362- const versionOutput = yield checkVersion ( "tar" ) ;
3361+ const versionOutput = yield getVersion ( "tar" ) ;
33633362 return versionOutput . toLowerCase ( ) . includes ( "gnu tar" ) ;
33643363 } ) ;
33653364}
@@ -5068,7 +5067,7 @@ function execTar(args, cwd) {
50685067 var _a ;
50695068 return __awaiter ( this , void 0 , void 0 , function * ( ) {
50705069 try {
5071- yield exec_1 . exec ( `${ yield getTarPath ( args ) } ` , args , { cwd : cwd } ) ;
5070+ yield exec_1 . exec ( `" ${ yield getTarPath ( args ) } " ` , args , { cwd : cwd } ) ;
50725071 }
50735072 catch ( error ) {
50745073 throw new Error ( `Tar failed with error: ${ ( _a = error ) === null || _a === void 0 ? void 0 : _a . message } ` ) ;
@@ -5079,14 +5078,22 @@ function getWorkingDirectory() {
50795078 var _a ;
50805079 return _a = process . env [ "GITHUB_WORKSPACE" ] , ( _a !== null && _a !== void 0 ? _a : process . cwd ( ) ) ;
50815080}
5081+ function isOS64 ( ) {
5082+ return process . platform != "win32" || process . arch === "x64" ;
5083+ }
50825084function extractTar ( archivePath , compressionMethod ) {
50835085 return __awaiter ( this , void 0 , void 0 , function * ( ) {
50845086 // Create directory to extract tar into
50855087 const workingDirectory = getWorkingDirectory ( ) ;
50865088 yield io . mkdirP ( workingDirectory ) ;
5089+ // --d: Decompress.
5090+ // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
50875091 const args = [
50885092 ...( compressionMethod == constants_1 . CompressionMethod . Zstd
5089- ? [ "--use-compress-program" , "zstd -d" ]
5093+ ? [
5094+ "--use-compress-program" ,
5095+ isOS64 ( ) ? "zstd -d --long=31" : "zstd -d --long=30"
5096+ ]
50905097 : [ "-z" ] ) ,
50915098 "-xf" ,
50925099 archivePath . replace ( new RegExp ( "\\" + path . sep , "g" ) , "/" ) ,
@@ -5105,10 +5112,14 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
51055112 const cacheFileName = utils . getCacheFileName ( compressionMethod ) ;
51065113 fs_1 . writeFileSync ( path . join ( archiveFolder , manifestFilename ) , sourceDirectories . join ( "\n" ) ) ;
51075114 // -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
5115+ // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
51085116 const workingDirectory = getWorkingDirectory ( ) ;
51095117 const args = [
51105118 ...( compressionMethod == constants_1 . CompressionMethod . Zstd
5111- ? [ "--use-compress-program" , "zstd -T0" ]
5119+ ? [
5120+ "--use-compress-program" ,
5121+ isOS64 ( ) ? "zstd -T0 --long=31" : "zstd -T0 --long=30"
5122+ ]
51125123 : [ "-z" ] ) ,
51135124 "-cf" ,
51145125 cacheFileName . replace ( new RegExp ( "\\" + path . sep , "g" ) , "/" ) ,
0 commit comments