mirror of
https://github.com/SamKirkland/FTP-Deploy-Action.git
synced 2025-08-15 06:25:05 +00:00
README update, and rebuild of index.js
This commit is contained in:
parent
af948b8060
commit
4938a6057e
@ -53,6 +53,7 @@ I recommend you store your `ftp-password` as a secret.
|
|||||||
| `ftp-password` | Yes | CrazyUniquePassword&%123 | | FTP account password |
|
| `ftp-password` | Yes | CrazyUniquePassword&%123 | | FTP account password |
|
||||||
| `local-dir` | No | deploy/ | ./ | Which local folder to deploy, path should be relative to the root and should include trailing slash. `./` is the root of the project |
|
| `local-dir` | No | deploy/ | ./ | Which local folder to deploy, path should be relative to the root and should include trailing slash. `./` is the root of the project |
|
||||||
| `git-ftp-args` | No | See `git-ftp-args` section below | | Custom git-ftp arguments, this field is passed through directly into the git-ftp script |
|
| `git-ftp-args` | No | See `git-ftp-args` section below | | Custom git-ftp arguments, this field is passed through directly into the git-ftp script |
|
||||||
|
| `known-hosts` | No | ```hostname ssh-rsa AAAAB3NzaC1y...``` | | The desired contents of your .ssh/known_hosts file |
|
||||||
|
|
||||||
#### Advanced options using `git-ftp-args`
|
#### Advanced options using `git-ftp-args`
|
||||||
Custom arguments, this field is passed through directly into the git-ftp script. See [git-ftp's manual](https://github.com/git-ftp/git-ftp/blob/master/man/git-ftp.1.md) for all options.
|
Custom arguments, this field is passed through directly into the git-ftp script. See [git-ftp's manual](https://github.com/git-ftp/git-ftp/blob/master/man/git-ftp.1.md) for all options.
|
||||||
@ -73,6 +74,10 @@ Below is an incomplete list of commonly used args:
|
|||||||
| `--insecure` | Don't verify server's certificate |
|
| `--insecure` | Don't verify server's certificate |
|
||||||
| `--cacert <file>` | Use as CA certificate store. Useful when a server has a self-signed certificate |
|
| `--cacert <file>` | Use as CA certificate store. Useful when a server has a self-signed certificate |
|
||||||
|
|
||||||
|
#### SFTP (FTP ovder SSH)
|
||||||
|
If you are getting a curl error similar to `SSL peer certificate or SSH remote key was not OK` and you are using SFTP (which is different from FTPS) then you need to supply a known_hosts entry via the `known-hosts` configuration option..
|
||||||
|
|
||||||
|
If you are on Linux, or OSX (using homebrew) you can install the OpenSSH packages and use `ssh-keyscan <hostname>` to get the known_hosts value needed for the server you are connecting to.
|
||||||
|
|
||||||
### Ignore specific files when deploying
|
### Ignore specific files when deploying
|
||||||
Add patterns to `.git-ftp-ignore` and all matching file names will be ignored. The patterns are interpreted as shell glob patterns.
|
Add patterns to `.git-ftp-ignore` and all matching file names will be ignored. The patterns are interpreted as shell glob patterns.
|
||||||
|
47
dist/index.js
vendored
47
dist/index.js
vendored
@ -666,28 +666,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const fs_1 = __importDefault(__webpack_require__(747));
|
const fs_1 = __importDefault(__webpack_require__(747));
|
||||||
|
const util_1 = __webpack_require__(669);
|
||||||
|
const writeFileAsync = util_1.promisify(fs_1.default.writeFile);
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const userArguments = getUserArguments();
|
const userArguments = getUserArguments();
|
||||||
if ('' !== userArguments.knownHosts) {
|
|
||||||
try {
|
|
||||||
yield exec.exec(`mkdir -v -p ${process.env['HOME']}/.ssh`);
|
|
||||||
yield exec.exec(`chmod 700 ${process.env['HOME']}/.ssh`);
|
|
||||||
fs_1.default.writeFile(process.env['HOME'] + '/.ssh/known_hosts', userArguments.knownHosts, (err) => {
|
|
||||||
if (err)
|
|
||||||
throw err;
|
|
||||||
console.log('Wrote ' + process.env['HOME'] + '/.ssh/known_hosts');
|
|
||||||
});
|
|
||||||
yield exec.exec(`chmod 755 ${process.env['HOME']}/.ssh/known_hosts`);
|
|
||||||
console.log("✅ Configured known_hosts");
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.error("⚠️ Error configuring known_hosts");
|
|
||||||
core.setFailed(error.message);
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
yield configureHost(userArguments);
|
||||||
yield syncFiles(userArguments);
|
yield syncFiles(userArguments);
|
||||||
console.log("✅ Deploy Complete");
|
console.log("✅ Deploy Complete");
|
||||||
}
|
}
|
||||||
@ -698,6 +683,25 @@ function run() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
run();
|
run();
|
||||||
|
function configureHost(args) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (args.knownHosts === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const sshFolder = `${process.env['HOME']}/.ssh`;
|
||||||
|
yield exec.exec(`mkdir -v -p ${sshFolder}`);
|
||||||
|
yield exec.exec(`chmod 700 ${sshFolder}`);
|
||||||
|
writeFileAsync(`${sshFolder}/known_hosts`, args.knownHosts);
|
||||||
|
yield exec.exec(`chmod 755 ${sshFolder}/known_hosts`);
|
||||||
|
console.log("✅ Configured known_hosts");
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error("⚠️ Error configuring known_hosts");
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function getUserArguments() {
|
function getUserArguments() {
|
||||||
return {
|
return {
|
||||||
ftp_server: core.getInput("ftp-server", { required: true }),
|
ftp_server: core.getInput("ftp-server", { required: true }),
|
||||||
@ -1024,6 +1028,13 @@ module.exports = require("path");
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 669:
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("util");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 747:
|
/***/ 747:
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user