Skip to content

Commit b3079c4

Browse files
Fix unpacking steps
1 parent 8c321e6 commit b3079c4

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

dist/index.js

+10-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const fs = require("fs");
22
const core = require("@actions/core");
33
const tc = require("@actions/tool-cache");
44
const os = require("os");
5+
const path = require("path");
56

67
async function run() {
78
const version = resolveVersionInput();
@@ -20,17 +21,21 @@ async function installToolchain(url, version, platform) {
2021
core.info("Toolchain already installed.");
2122
return cachePath;
2223
}
23-
core.debug(`Downloading tool from ${url}`);
24+
core.info(`Downloading tool from ${url}`);
2425
const downloadPath = await tc.downloadTool(url);
2526
core.debug(`Installing toolchain from ${downloadPath}`);
2627
let toolchainPath;
2728
switch (platform.pkg) {
28-
case "tar.gz":
29-
toolchainPath = await tc.extractTar(downloadPath);
29+
case "tar.gz": {
30+
const extractedPath = await tc.extractTar(downloadPath);
31+
toolchainPath = path.join(extractedPath, `swift-${version}`);
3032
break;
31-
case "pkg":
32-
toolchainPath = await tc.extractXar(downloadPath);
33+
}
34+
case "pkg": {
35+
const extractedPath = await tc.extractXar(downloadPath);
36+
toolchainPath = await tc.extractTar(path.join(extractedPath, "Payload"));
3337
break;
38+
}
3439
default:
3540
throw new Error(`Unsupported package type: ${platform.pkg}`);
3641
}

package-lock.json

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"homepage": "https://github.com/swiftwasm/setup-swiftwasm#readme",
2929
"dependencies": {
3030
"@actions/core": "^1.10.0",
31+
"@actions/exec": "^1.1.1",
3132
"@actions/tool-cache": "^2.0.1"
3233
},
3334
"devDependencies": {

0 commit comments

Comments
 (0)