mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-12-25 03:55:56 +00:00
Use path.sep in path replace
This commit is contained in:
parent
08438313d5
commit
52046d1409
4 changed files with 17 additions and 21 deletions
|
@ -51,10 +51,10 @@ test("extract BSD tar", async () => {
|
||||||
[
|
[
|
||||||
"-xz",
|
"-xz",
|
||||||
"-f",
|
"-f",
|
||||||
archivePath?.replace(/\\/g, "/"),
|
IS_WINDOWS ? archivePath.replace(/\\/g, "/") : archivePath,
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
workspace?.replace(/\\/g, "/")
|
IS_WINDOWS ? workspace?.replace(/\\/g, "/") : workspace
|
||||||
],
|
],
|
||||||
{ cwd: undefined }
|
{ cwd: undefined }
|
||||||
);
|
);
|
||||||
|
@ -78,7 +78,7 @@ test("extract GNU tar", async () => {
|
||||||
[
|
[
|
||||||
"-xz",
|
"-xz",
|
||||||
"-f",
|
"-f",
|
||||||
archivePath?.replace(/\\/g, "/"),
|
archivePath.replace(/\\/g, "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
workspace?.replace(/\\/g, "/"),
|
workspace?.replace(/\\/g, "/"),
|
||||||
|
@ -111,10 +111,10 @@ test("create BSD tar", async () => {
|
||||||
[
|
[
|
||||||
"-cz",
|
"-cz",
|
||||||
"-f",
|
"-f",
|
||||||
CacheFilename?.replace(/\\/g, "/"),
|
IS_WINDOWS ? CacheFilename.replace(/\\/g, "/") : CacheFilename,
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
workspace?.replace(/\\/g, "/"),
|
IS_WINDOWS ? workspace?.replace(/\\/g, "/") : workspace,
|
||||||
"--files-from",
|
"--files-from",
|
||||||
"manifest.txt"
|
"manifest.txt"
|
||||||
],
|
],
|
||||||
|
|
10
dist/restore/index.js
vendored
10
dist/restore/index.js
vendored
|
@ -5014,7 +5014,6 @@ function getWorkingDirectory() {
|
||||||
return _a = process.env["GITHUB_WORKSPACE"], (_a !== null && _a !== void 0 ? _a : process.cwd());
|
return _a = process.env["GITHUB_WORKSPACE"], (_a !== null && _a !== void 0 ? _a : process.cwd());
|
||||||
}
|
}
|
||||||
function extractTar(archivePath) {
|
function extractTar(archivePath) {
|
||||||
var _a, _b;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Create directory to extract tar into
|
// Create directory to extract tar into
|
||||||
const workingDirectory = getWorkingDirectory();
|
const workingDirectory = getWorkingDirectory();
|
||||||
|
@ -5022,17 +5021,16 @@ function extractTar(archivePath) {
|
||||||
const args = [
|
const args = [
|
||||||
"-xz",
|
"-xz",
|
||||||
"-f",
|
"-f",
|
||||||
(_a = archivePath) === null || _a === void 0 ? void 0 : _a.replace(/\\/g, "/"),
|
archivePath.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
(_b = workingDirectory) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, "/")
|
workingDirectory.replace(new RegExp("\\" + path.sep, "g"), "/")
|
||||||
];
|
];
|
||||||
yield execTar(args);
|
yield execTar(args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.extractTar = extractTar;
|
exports.extractTar = extractTar;
|
||||||
function createTar(archiveFolder, sourceDirectories) {
|
function createTar(archiveFolder, sourceDirectories) {
|
||||||
var _a, _b;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Write source directories to manifest.txt to avoid command length limits
|
// Write source directories to manifest.txt to avoid command length limits
|
||||||
const manifestFilename = "manifest.txt";
|
const manifestFilename = "manifest.txt";
|
||||||
|
@ -5041,10 +5039,10 @@ function createTar(archiveFolder, sourceDirectories) {
|
||||||
const args = [
|
const args = [
|
||||||
"-cz",
|
"-cz",
|
||||||
"-f",
|
"-f",
|
||||||
(_a = constants_1.CacheFilename) === null || _a === void 0 ? void 0 : _a.replace(/\\/g, "/"),
|
constants_1.CacheFilename.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
(_b = workingDirectory) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, "/"),
|
workingDirectory.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"--files-from",
|
"--files-from",
|
||||||
manifestFilename
|
manifestFilename
|
||||||
];
|
];
|
||||||
|
|
10
dist/save/index.js
vendored
10
dist/save/index.js
vendored
|
@ -4991,7 +4991,6 @@ function getWorkingDirectory() {
|
||||||
return _a = process.env["GITHUB_WORKSPACE"], (_a !== null && _a !== void 0 ? _a : process.cwd());
|
return _a = process.env["GITHUB_WORKSPACE"], (_a !== null && _a !== void 0 ? _a : process.cwd());
|
||||||
}
|
}
|
||||||
function extractTar(archivePath) {
|
function extractTar(archivePath) {
|
||||||
var _a, _b;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Create directory to extract tar into
|
// Create directory to extract tar into
|
||||||
const workingDirectory = getWorkingDirectory();
|
const workingDirectory = getWorkingDirectory();
|
||||||
|
@ -4999,17 +4998,16 @@ function extractTar(archivePath) {
|
||||||
const args = [
|
const args = [
|
||||||
"-xz",
|
"-xz",
|
||||||
"-f",
|
"-f",
|
||||||
(_a = archivePath) === null || _a === void 0 ? void 0 : _a.replace(/\\/g, "/"),
|
archivePath.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
(_b = workingDirectory) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, "/")
|
workingDirectory.replace(new RegExp("\\" + path.sep, "g"), "/")
|
||||||
];
|
];
|
||||||
yield execTar(args);
|
yield execTar(args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.extractTar = extractTar;
|
exports.extractTar = extractTar;
|
||||||
function createTar(archiveFolder, sourceDirectories) {
|
function createTar(archiveFolder, sourceDirectories) {
|
||||||
var _a, _b;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Write source directories to manifest.txt to avoid command length limits
|
// Write source directories to manifest.txt to avoid command length limits
|
||||||
const manifestFilename = "manifest.txt";
|
const manifestFilename = "manifest.txt";
|
||||||
|
@ -5018,10 +5016,10 @@ function createTar(archiveFolder, sourceDirectories) {
|
||||||
const args = [
|
const args = [
|
||||||
"-cz",
|
"-cz",
|
||||||
"-f",
|
"-f",
|
||||||
(_a = constants_1.CacheFilename) === null || _a === void 0 ? void 0 : _a.replace(/\\/g, "/"),
|
constants_1.CacheFilename.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
(_b = workingDirectory) === null || _b === void 0 ? void 0 : _b.replace(/\\/g, "/"),
|
workingDirectory.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"--files-from",
|
"--files-from",
|
||||||
manifestFilename
|
manifestFilename
|
||||||
];
|
];
|
||||||
|
|
|
@ -56,10 +56,10 @@ export async function extractTar(archivePath: string): Promise<void> {
|
||||||
const args = [
|
const args = [
|
||||||
"-xz",
|
"-xz",
|
||||||
"-f",
|
"-f",
|
||||||
archivePath?.replace(/\\/g, "/"),
|
archivePath.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
workingDirectory?.replace(/\\/g, "/")
|
workingDirectory.replace(new RegExp("\\" + path.sep, "g"), "/")
|
||||||
];
|
];
|
||||||
await execTar(args);
|
await execTar(args);
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,10 @@ export async function createTar(
|
||||||
const args = [
|
const args = [
|
||||||
"-cz",
|
"-cz",
|
||||||
"-f",
|
"-f",
|
||||||
CacheFilename?.replace(/\\/g, "/"),
|
CacheFilename.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"-P",
|
"-P",
|
||||||
"-C",
|
"-C",
|
||||||
workingDirectory?.replace(/\\/g, "/"),
|
workingDirectory.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||||
"--files-from",
|
"--files-from",
|
||||||
manifestFilename
|
manifestFilename
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue