Skip to content

Commit 8753116

Browse files
committed
Bump to 1.2.0
1 parent 02cabca commit 8753116

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

dist/index.js

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7607,12 +7607,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
76077607
});
76087608
};
76097609
Object.defineProperty(exports, "__esModule", { value: true });
7610-
exports.extractXar = exports.install = void 0;
7610+
exports.install = void 0;
76117611
const core = __importStar(__webpack_require__(470));
76127612
const toolCache = __importStar(__webpack_require__(533));
7613-
const io = __importStar(__webpack_require__(1));
76147613
const path = __importStar(__webpack_require__(622));
7615-
const exec_1 = __webpack_require__(986);
76167614
const swift_versions_1 = __webpack_require__(336);
76177615
const get_version_1 = __webpack_require__(778);
76187616
function install(version, system) {
@@ -7660,25 +7658,14 @@ function download({ url }) {
76607658
function unpack({ name }, packagePath, version) {
76617659
return __awaiter(this, void 0, void 0, function* () {
76627660
core.debug("Extracting package");
7663-
const unpackedPath = yield extractXar(packagePath);
7661+
const unpackedPath = yield toolCache.extractXar(packagePath);
76647662
const extractedPath = yield toolCache.extractTar(path.join(unpackedPath, `${name}-package.pkg`, "Payload"));
76657663
core.debug("Package extracted");
76667664
const cachedPath = yield toolCache.cacheDir(extractedPath, "swift-macOS", version);
76677665
core.debug("Package cached");
76687666
return cachedPath;
76697667
});
76707668
}
7671-
//FIXME: Workaround until https://github.com/actions/toolkit/pull/207 is merged
7672-
function extractXar(file) {
7673-
return __awaiter(this, void 0, void 0, function* () {
7674-
const dest = path.join(process.env["RUNNER_TEMP"] || "", "setup-swift", "extract.tmp");
7675-
yield io.mkdirP(dest);
7676-
const xarPath = yield io.which("xar", true);
7677-
yield exec_1.exec(`"${xarPath}"`, ["-x", "-C", dest, "-f", file]);
7678-
return dest;
7679-
});
7680-
}
7681-
exports.extractXar = extractXar;
76827669

76837670

76847671
/***/ }),
@@ -8612,6 +8599,7 @@ class HTTPError extends Error {
86128599
}
86138600
exports.HTTPError = HTTPError;
86148601
const IS_WINDOWS = process.platform === 'win32';
8602+
const IS_MAC = process.platform === 'darwin';
86158603
const userAgent = 'actions/tool-cache';
86168604
/**
86178605
* Download a tool from an url and stream it into a file
@@ -8827,6 +8815,36 @@ function extractTar(file, dest, flags = 'xz') {
88278815
});
88288816
}
88298817
exports.extractTar = extractTar;
8818+
/**
8819+
* Extract a xar compatible archive
8820+
*
8821+
* @param file path to the archive
8822+
* @param dest destination directory. Optional.
8823+
* @param flags flags for the xar. Optional.
8824+
* @returns path to the destination directory
8825+
*/
8826+
function extractXar(file, dest, flags = []) {
8827+
return __awaiter(this, void 0, void 0, function* () {
8828+
assert_1.ok(IS_MAC, 'extractXar() not supported on current OS');
8829+
assert_1.ok(file, 'parameter "file" is required');
8830+
dest = yield _createExtractFolder(dest);
8831+
let args;
8832+
if (flags instanceof Array) {
8833+
args = flags;
8834+
}
8835+
else {
8836+
args = [flags];
8837+
}
8838+
args.push('-x', '-C', dest, '-f', file);
8839+
if (core.isDebug()) {
8840+
args.push('-v');
8841+
}
8842+
const xarPath = yield io.which('xar', true);
8843+
yield exec_1.exec(`"${xarPath}"`, _unique(args));
8844+
return dest;
8845+
});
8846+
}
8847+
exports.extractXar = extractXar;
88308848
/**
88318849
* Extract a zip
88328850
*
@@ -9135,6 +9153,13 @@ function _getGlobal(key, defaultValue) {
91359153
/* eslint-enable @typescript-eslint/no-explicit-any */
91369154
return value !== undefined ? value : defaultValue;
91379155
}
9156+
/**
9157+
* Returns an array of unique values.
9158+
* @param values Values to make unique.
9159+
*/
9160+
function _unique(values) {
9161+
return Array.from(new Set(values));
9162+
}
91389163
//# sourceMappingURL=tool-cache.js.map
91399164

91409165
/***/ }),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-swift",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Set up GitHub Actions workflow with Swift support",
55
"private": true,
66
"main": "lib/main.js",

0 commit comments

Comments
 (0)