File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 66 with :
77 private-key : ${{ secrets.PRIVATE_KEY }}
88 known-hosts : ${{ secrets.KNOWN_HOSTS }}
9+ ssh-config : ${{ secrets.SSH_CONFIG }}
910 dep : deploy prod -v
1011` ` `
1112
1213## Inputs
1314
1415- ` private-key` - Required. A private key to accessing servers.
15- - ` known-hosts` - Optional. Host fingerprints. If omitted `StrictHostKeyChecking=no` will be used.
16+ - ` known-hosts` - Optional. Host fingerprints. If omitted `StrictHostKeyChecking=no` will be used unless `ssh-config` is provided.
17+ - ` ssh-config` - Optional. SSH configuration.
1618- ` dep` - Required. Arguments to pass to Deployer command.
1719
1820# # Deployer version
@@ -41,5 +43,6 @@ deploy:
4143 with:
4244 private-key: ${{ secrets.PRIVATE_KEY }}
4345 known-hosts: ${{ secrets.KNOWN_HOSTS }}
46+ ssh-config: ${{ secrets.SSH_CONFIG }}
4447 dep: deploy prod -v
4548` ` `
Original file line number Diff line number Diff line change 88 description : ' Known hosts'
99 required : false
1010 default : ' '
11+ ssh-config :
12+ description : ' SSH configuration'
13+ required : false
14+ default : ' '
1115 dep :
1216 description : ' Deployer command'
1317 required : false
Original file line number Diff line number Diff line change @@ -26,12 +26,17 @@ function ssh() {
2626 let privateKey = core . getInput ( 'private-key' ) . replace ( '/\r/g' , '' ) . trim ( ) + '\n'
2727 execa . sync ( 'ssh-add' , [ '-' ] , { input : privateKey } )
2828
29- let knownHosts = core . getInput ( 'known-hosts' )
30- if ( knownHosts === '' ) {
31- fs . appendFileSync ( `${ ssh } /config` , `StrictHostKeyChecking no` )
32- } else {
29+ const knownHosts = core . getInput ( 'known-hosts' )
30+ if ( knownHosts !== '' ) {
3331 fs . appendFileSync ( `${ ssh } /known_hosts` , knownHosts )
3432 fs . chmodSync ( `${ ssh } /known_hosts` , '644' )
33+ } else {
34+ fs . appendFileSync ( `${ ssh } /config` , `StrictHostKeyChecking no` )
35+ }
36+
37+ const sshConfig = core . getInput ( 'ssh-config' )
38+ if ( sshConfig !== '' ) {
39+ fs . writeFile ( `${ ssh } /config` , sshConfig )
3540 }
3641}
3742
You can’t perform that action at this time.
0 commit comments