Skip to content

Commit cd21dd2

Browse files
committed
fix: extract zip files using 7z on windows
`extractZip` from @actions uses the pre-installed PowerShell This doesn't work properly with old PowerShell versions
1 parent ba5279b commit cd21dd2

File tree

7 files changed

+42
-31
lines changed

7 files changed

+42
-31
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-lock.yaml

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

src/cmake/cmake.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { extractZip, extractTar } from "@actions/tool-cache"
1+
import { extractTar } from "@actions/tool-cache"
22
import semverLte from "semver/functions/lte"
33
import semverCoerce from "semver/functions/coerce"
44
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
55
import { addBinExtension } from "../utils/extension/extension"
6+
import { extractZip } from "../utils/setup/extract"
67

78
/** Get the platform data for cmake */
89
function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {

src/ninja/ninja.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { extractZip } from "@actions/tool-cache"
21
import { addBinExtension } from "../utils/extension/extension"
2+
import { extractZip } from "../utils/setup/extract"
33
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
44

55
/** Get the platform name Ninja uses in their download links */

src/task/task.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { extractZip } from "@actions/tool-cache"
21
import { addBinExtension } from "../utils/extension/extension"
3-
import { extractTarByExe } from "../utils/setup/extract"
2+
import { extractTarByExe, extractZip } from "../utils/setup/extract"
43
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
54

65
/** Get the platform name task uses in their download links */

src/utils/setup/extract.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { mkdirP } from "@actions/io"
33
import which from "which"
44
import { setupSevenZip } from "../../sevenzip/sevenzip"
55
import { warning } from "../io/io"
6-
export { extractTar, extractXar, extract7z } from "@actions/tool-cache"
6+
export { extractTar, extractXar } from "@actions/tool-cache"
77

88
let sevenZip: string | undefined
99

10-
export async function extractExe(file: string, dest: string) {
10+
/// Extract 7z using 7z
11+
export async function extract7Zip(file: string, dest: string) {
1112
await execa(await getSevenZip(), ["x", file, `-o${dest}`], { stdio: "inherit" })
1213
return dest
1314
}
@@ -24,6 +25,16 @@ async function getSevenZip() {
2425
return sevenZip
2526
}
2627

28+
/// Extract Exe using 7z
29+
export async function extractExe(file: string, dest: string) {
30+
return extract7Zip(file, dest)
31+
}
32+
33+
/// Extract Zip using 7z
34+
export async function extractZip(file: string, dest: string) {
35+
return extract7Zip(file, dest)
36+
}
37+
2738
export async function extractTarByExe(file: string, dest: string, flags = ["--strip-components=0"]) {
2839
try {
2940
await mkdirP(dest)

0 commit comments

Comments
 (0)