fixing relative path and permission (#24)

* fix relative path

* fix chmod 600 .ssh/known_hosts and .ssh/config
This commit is contained in:
zivan 2021-09-21 02:23:18 +07:00 committed by GitHub
parent 9eab20634f
commit c17d254b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,14 +29,16 @@ function ssh() {
const knownHosts = core.getInput('known-hosts') const knownHosts = core.getInput('known-hosts')
if (knownHosts !== '') { if (knownHosts !== '') {
fs.appendFileSync(`${ssh}/known_hosts`, knownHosts) fs.appendFileSync(`${ssh}/known_hosts`, knownHosts)
fs.chmodSync(`${ssh}/known_hosts`, '644') fs.chmodSync(`${ssh}/known_hosts`, '600')
} else { } else {
fs.appendFileSync(`${ssh}/config`, `StrictHostKeyChecking no`) fs.appendFileSync(`${ssh}/config`, `StrictHostKeyChecking no`)
fs.chmodSync(`${ssh}/config`, '600')
} }
const sshConfig = core.getInput('ssh-config') const sshConfig = core.getInput('ssh-config')
if (sshConfig !== '') { if (sshConfig !== '') {
fs.writeFile(`${ssh}/config`, sshConfig) fs.writeFile(`${ssh}/config`, sshConfig)
fs.chmodSync(`${ssh}/config`, '600')
} }
} }
@ -52,7 +54,7 @@ function dep() {
if (!dep) { if (!dep) {
execa.commandSync('curl -LO https://deployer.org/deployer.phar') execa.commandSync('curl -LO https://deployer.org/deployer.phar')
execa.commandSync('sudo chmod +x deployer.phar') execa.commandSync('sudo chmod +x deployer.phar')
dep = 'deployer.phar' dep = './deployer.phar'
} }
const subprocess = execa(dep, split(core.getInput('dep'))) const subprocess = execa(dep, split(core.getInput('dep')))