Skip to content

Commit 277d6a8

Browse files
committed
Update(action): setup public/private ssh key
1 parent 44204d2 commit 277d6a8

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

action.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ inputs:
1111
password:
1212
required: true
1313
description: runway password
14+
public-key:
15+
description: ssh public key (secret)
16+
required: false
17+
private-key:
18+
description: ssh private key (secret)
19+
required: false
1420
public-key-location:
1521
description: ssh public key location
1622
required: true
@@ -40,6 +46,19 @@ inputs:
4046
runs:
4147
using: "composite"
4248
steps:
49+
- name: setup your ssh public and private key
50+
shell: bash
51+
if: ${{ inputs.private-key != '' && inputs.public-key != '' }}
52+
run: |
53+
mkdir -p ~/.ssh/
54+
echo "${{ inputs.private-key }}" > ${{ inputs.private-key-location }}
55+
echo "${{ inputs.public-key }}" > ${{ inputs.public-key-location }}
56+
chmod 0600 ${{ inputs.private-key-location }}
57+
chmod 0600 ${{ inputs.public-key-location }}
58+
echo "SSH keys added ✅" >> $GITHUB_STEP_SUMMARY
59+
echo "" >> $GITHUB_STEP_SUMMARY
60+
echo " - public key in ${{ inputs.public-key-location }}" >> $GITHUB_STEP_SUMMARY
61+
echo " - private key in ${{ inputs.private-key-location }}" >> $GITHUB_STEP_SUMMARY
4362
- shell: bash
4463
run: |
4564
ARCH=$(uname -m)
@@ -78,13 +97,17 @@ runs:
7897
if: ${{ inputs.add-key == 'true' }}
7998
shell: bash
8099
- run: |
81-
echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV
100+
SSH_AUTH_SOCK=/tmp/ssh_agent.sock
101+
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
82102
ssh-keyscan -p 2222 deploy.runway.horse >> ~/.ssh/known_hosts
83103
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
84104
ssh-add ${{ inputs.private-key-location }}
85-
if: ${{ inputs.setup-ssh == 'true' }}
105+
echo "ssh setup complete ✅" >> $GITHUB_STEP_SUMMARY
106+
if: ${{ inputs.setup-ssh == 'true' || (inputs.private-key != '' && inputs.public-key != '') }}
86107
shell: bash
87-
- run: echo "RUNWAY_CONTROLLER=${{ inputs.controller-url }}" >> $GITHUB_ENV
108+
- run: |
109+
echo "RUNWAY_CONTROLLER=${{ inputs.controller-url }}" >> $GITHUB_ENV
110+
echo "Set a custom controller ✅" >> $GITHUB_STEP_SUMMARY
88111
if: ${{ inputs.controller-url != '' }}
89112
shell: bash
90113
- shell: bash

0 commit comments

Comments
 (0)