mirror of
https://github.com/deployphp/action.git
synced 2024-11-23 04:19:02 +00:00
parent
4b3c564869
commit
ad4e7856ef
@ -6,13 +6,15 @@
|
|||||||
with:
|
with:
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
known-hosts: ${{ secrets.KNOWN_HOSTS }}
|
known-hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
ssh-config: ${{ secrets.SSH_CONFIG }}
|
||||||
dep: deploy prod -v
|
dep: deploy prod -v
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `private-key` - Required. A private key to accessing servers.
|
- `private-key` - Required. A private key to accessing servers.
|
||||||
- `known-hosts` - Optional. Host fingerprints. If omitted `StrictHostKeyChecking=no` will be used.
|
- `known-hosts` - Optional. Host fingerprints. If omitted `StrictHostKeyChecking=no` will be used unless `ssh-config` is provided.
|
||||||
|
- `ssh-config` - Optional. SSH configuration.
|
||||||
- `dep` - Required. Arguments to pass to Deployer command.
|
- `dep` - Required. Arguments to pass to Deployer command.
|
||||||
|
|
||||||
## Deployer version
|
## Deployer version
|
||||||
@ -41,5 +43,6 @@ deploy:
|
|||||||
with:
|
with:
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
known-hosts: ${{ secrets.KNOWN_HOSTS }}
|
known-hosts: ${{ secrets.KNOWN_HOSTS }}
|
||||||
|
ssh-config: ${{ secrets.SSH_CONFIG }}
|
||||||
dep: deploy prod -v
|
dep: deploy prod -v
|
||||||
```
|
```
|
||||||
|
@ -8,6 +8,10 @@ inputs:
|
|||||||
description: 'Known hosts'
|
description: 'Known hosts'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
ssh-config:
|
||||||
|
description: 'SSH configuration'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
dep:
|
dep:
|
||||||
description: 'Deployer command'
|
description: 'Deployer command'
|
||||||
required: false
|
required: false
|
||||||
|
13
index.js
13
index.js
@ -26,12 +26,17 @@ function ssh() {
|
|||||||
let privateKey = core.getInput('private-key').replace('/\r/g', '').trim() + '\n'
|
let privateKey = core.getInput('private-key').replace('/\r/g', '').trim() + '\n'
|
||||||
execa.sync('ssh-add', ['-'], {input: privateKey})
|
execa.sync('ssh-add', ['-'], {input: privateKey})
|
||||||
|
|
||||||
let knownHosts = core.getInput('known-hosts')
|
const knownHosts = core.getInput('known-hosts')
|
||||||
if (knownHosts === '') {
|
if (knownHosts !== '') {
|
||||||
fs.appendFileSync(`${ssh}/config`, `StrictHostKeyChecking no`)
|
|
||||||
} else {
|
|
||||||
fs.appendFileSync(`${ssh}/known_hosts`, knownHosts)
|
fs.appendFileSync(`${ssh}/known_hosts`, knownHosts)
|
||||||
fs.chmodSync(`${ssh}/known_hosts`, '644')
|
fs.chmodSync(`${ssh}/known_hosts`, '644')
|
||||||
|
} else {
|
||||||
|
fs.appendFileSync(`${ssh}/config`, `StrictHostKeyChecking no`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const sshConfig = core.getInput('ssh-config')
|
||||||
|
if (sshConfig !== '') {
|
||||||
|
fs.writeFile(`${ssh}/config`, sshConfig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user