mirror of
https://github.com/SamKirkland/FTP-Deploy-Action.git
synced 2025-08-14 22:15:05 +00:00
Add track state option
This commit is contained in:
parent
cfcb39fa3c
commit
eb1f39d2fd
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -3191,9 +3191,13 @@ function downloadFileList(client, logger, path) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function createLocalState(localFiles, logger, args) {
|
function createLocalState(localFiles, logger, args) {
|
||||||
|
if (args["track-state"]) {
|
||||||
logger.verbose(`Creating local state at ${args["local-dir"]}${args["state-name"]}`);
|
logger.verbose(`Creating local state at ${args["local-dir"]}${args["state-name"]}`);
|
||||||
fs_1.default.writeFileSync(`${args["local-dir"]}${args["state-name"]}`, JSON.stringify(localFiles, undefined, 4), { encoding: "utf8" });
|
fs_1.default.writeFileSync(`${args["local-dir"]}${args["state-name"]}`, JSON.stringify(localFiles, undefined, 4), { encoding: "utf8" });
|
||||||
logger.verbose("Local state created");
|
logger.verbose("Local state created");
|
||||||
|
} else {
|
||||||
|
logger.verbose(`Not creating a local state because tracking is disabled`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function connect(client, args, logger) {
|
function connect(client, args, logger) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@ -3242,6 +3246,7 @@ function getServerFiles(client, logger, timings, args) {
|
|||||||
logger.all("Clear complete");
|
logger.all("Clear complete");
|
||||||
throw new Error("dangerous-clean-slate was run");
|
throw new Error("dangerous-clean-slate was run");
|
||||||
}
|
}
|
||||||
|
if (args['track-state']) {
|
||||||
const serverFiles = yield downloadFileList(client, logger, args["state-name"]);
|
const serverFiles = yield downloadFileList(client, logger, args["state-name"]);
|
||||||
logger.all(`----------------------------------------------------------------`);
|
logger.all(`----------------------------------------------------------------`);
|
||||||
logger.all(`Last published on 📅 ${new Date(serverFiles.generatedTime).toLocaleDateString(undefined, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric" })}`);
|
logger.all(`Last published on 📅 ${new Date(serverFiles.generatedTime).toLocaleDateString(undefined, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric" })}`);
|
||||||
@ -3252,6 +3257,7 @@ function getServerFiles(client, logger, timings, args) {
|
|||||||
}
|
}
|
||||||
return serverFiles;
|
return serverFiles;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
logger.all(`----------------------------------------------------------------`);
|
logger.all(`----------------------------------------------------------------`);
|
||||||
logger.all(`No file exists on the server "${args["server-dir"] + args["state-name"]}" - this must be your first publish! 🎉`);
|
logger.all(`No file exists on the server "${args["server-dir"] + args["state-name"]}" - this must be your first publish! 🎉`);
|
||||||
@ -3946,6 +3952,7 @@ function getDefaultSettings(withoutDefaults) {
|
|||||||
"log-level": (_j = withoutDefaults["log-level"]) !== null && _j !== void 0 ? _j : "standard",
|
"log-level": (_j = withoutDefaults["log-level"]) !== null && _j !== void 0 ? _j : "standard",
|
||||||
"security": (_k = withoutDefaults.security) !== null && _k !== void 0 ? _k : "loose",
|
"security": (_k = withoutDefaults.security) !== null && _k !== void 0 ? _k : "loose",
|
||||||
"timeout": (_l = withoutDefaults.timeout) !== null && _l !== void 0 ? _l : 30000,
|
"timeout": (_l = withoutDefaults.timeout) !== null && _l !== void 0 ? _l : 30000,
|
||||||
|
"track-state": (_m = withoutDefaults["track-state"]) !== null && _m !== void 0 ? _m : true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.getDefaultSettings = getDefaultSettings;
|
exports.getDefaultSettings = getDefaultSettings;
|
||||||
@ -9037,7 +9044,8 @@ async function runDeployment() {
|
|||||||
"dangerous-clean-slate": (0, parse_1.optionalBoolean)("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
"dangerous-clean-slate": (0, parse_1.optionalBoolean)("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
||||||
"exclude": (0, parse_1.optionalStringArray)("exclude", core.getMultilineInput("exclude")),
|
"exclude": (0, parse_1.optionalStringArray)("exclude", core.getMultilineInput("exclude")),
|
||||||
"log-level": (0, parse_1.optionalLogLevel)("log-level", core.getInput("log-level")),
|
"log-level": (0, parse_1.optionalLogLevel)("log-level", core.getInput("log-level")),
|
||||||
"security": (0, parse_1.optionalSecurity)("security", core.getInput("security"))
|
"security": (0, parse_1.optionalSecurity)("security", core.getInput("security")),
|
||||||
|
"track-state": (0, parse_1.optionalString)(core.getInput("track-state")),
|
||||||
};
|
};
|
||||||
await (0, ftp_deploy_1.deploy)(args);
|
await (0, ftp_deploy_1.deploy)(args);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ async function runDeployment() {
|
|||||||
"local-dir": optionalString(core.getInput("local-dir")),
|
"local-dir": optionalString(core.getInput("local-dir")),
|
||||||
"server-dir": optionalString(core.getInput("server-dir")),
|
"server-dir": optionalString(core.getInput("server-dir")),
|
||||||
"state-name": optionalString(core.getInput("state-name")),
|
"state-name": optionalString(core.getInput("state-name")),
|
||||||
|
"track-state": optionalString(core.getInput("track-state")),
|
||||||
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
|
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
|
||||||
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
||||||
"exclude": optionalStringArray("exclude", core.getMultilineInput("exclude")),
|
"exclude": optionalStringArray("exclude", core.getMultilineInput("exclude")),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user