Skip to content

Commit 67eeeea

Browse files
use zip and unzip from path (actions#161)
1 parent 3116829 commit 67eeeea

9 files changed

Lines changed: 8 additions & 30 deletions

File tree

package-lock.json

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/github/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-211 KB
Binary file not shown.
-168 KB
Binary file not shown.

packages/tool-cache/__tests__/tool-cache.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,7 @@ describe('@actions/tool-cache', function() {
287287
]
288288
await exec.exec(`"${powershellPath}"`, args)
289289
} else {
290-
const zipBin: string =
291-
process.platform === 'darwin' ? 'zip-darwin' : 'zip'
292-
const zipPath: string = path.join(__dirname, 'externals', zipBin)
290+
const zipPath: string = await io.which('zip')
293291
await exec.exec(`"${zipPath}`, [zipFile, '-r', '.'], {cwd: stagingDir})
294292
}
295293

@@ -340,9 +338,7 @@ describe('@actions/tool-cache', function() {
340338
]
341339
await exec.exec(`"${powershellPath}"`, args)
342340
} else {
343-
const zipBin: string =
344-
process.platform === 'darwin' ? 'zip-darwin' : 'zip'
345-
const zipPath = path.join(__dirname, 'externals', zipBin)
341+
const zipPath: string = await io.which('zip')
346342
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
347343
}
348344

packages/tool-cache/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-170 KB
Binary file not shown.
-181 KB
Binary file not shown.

packages/tool-cache/src/tool-cache.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,7 @@ export async function extractZip(file: string, dest?: string): Promise<string> {
223223
if (IS_WINDOWS) {
224224
await extractZipWin(file, dest)
225225
} else {
226-
if (process.platform === 'darwin') {
227-
await extractZipDarwin(file, dest)
228-
} else {
229-
await extractZipNix(file, dest)
230-
}
226+
await extractZipNix(file, dest)
231227
}
232228

233229
return dest
@@ -255,18 +251,7 @@ async function extractZipWin(file: string, dest: string): Promise<void> {
255251
}
256252

257253
async function extractZipNix(file: string, dest: string): Promise<void> {
258-
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip')
259-
await exec(`"${unzipPath}"`, [file], {cwd: dest})
260-
}
261-
262-
async function extractZipDarwin(file: string, dest: string): Promise<void> {
263-
const unzipPath = path.join(
264-
__dirname,
265-
'..',
266-
'scripts',
267-
'externals',
268-
'unzip-darwin'
269-
)
254+
const unzipPath = await io.which('unzip')
270255
await exec(`"${unzipPath}"`, [file], {cwd: dest})
271256
}
272257

0 commit comments

Comments
 (0)