diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index b1d52116..76bec600 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -114,4 +114,7 @@ - Fix issue with symlink restoration on windows. ### 3.1.3 -- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329). \ No newline at end of file +- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329). + +### 3.1.4 +- Fix zstd not being used due to `zstd --version` output change in zstd 1.5.4 release. See [#1353](https://github.com/actions/toolkit/pull/1353). \ No newline at end of file diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index f9a20106..408660cb 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", diff --git a/packages/cache/package.json b/packages/cache/package.json index f274e00c..3d5dda6b 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index ea1e7de6..650653ad 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -71,11 +71,15 @@ export async function unlinkFile(filePath: fs.PathLike): Promise { return util.promisify(fs.unlink)(filePath) } -async function getVersion(app: string): Promise { - core.debug(`Checking ${app} --version`) +async function getVersion( + app: string, + additionalArgs: string[] = [] +): Promise { let versionOutput = '' + additionalArgs.push('--version') + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`) try { - await exec.exec(`${app} --version`, [], { + await exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { @@ -94,18 +98,14 @@ async function getVersion(app: string): Promise { // Use zstandard if possible to maximize cache performance export async function getCompressionMethod(): Promise { - const versionOutput = await getVersion('zstd') + const versionOutput = await getVersion('zstd', ['--quiet']) const version = semver.clean(versionOutput) + core.debug(`zstd version: ${version}`) - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed + if (versionOutput === '') { return CompressionMethod.Gzip - } else if (!version || semver.lt(version, 'v1.3.2')) { - // zstd is installed but using a version earlier than v1.3.2 - // v1.3.2 is required to use the `--long` options in zstd - return CompressionMethod.ZstdWithoutLong } else { - return CompressionMethod.Zstd + return CompressionMethod.ZstdWithoutLong } }