Skip to content

Commit 139d2f4

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

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

action.yml

Lines changed: 28 additions & 4 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)
@@ -77,14 +96,19 @@ runs:
7796
echo "Imported a new key ✅" >> $GITHUB_STEP_SUMMARY
7897
if: ${{ inputs.add-key == 'true' }}
7998
shell: bash
80-
- run: |
81-
echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV
99+
- env:
100+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
101+
run: |
102+
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
82103
ssh-keyscan -p 2222 deploy.runway.horse >> ~/.ssh/known_hosts
83104
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
84105
ssh-add ${{ inputs.private-key-location }}
85-
if: ${{ inputs.setup-ssh == 'true' }}
106+
echo "ssh setup complete ✅" >> $GITHUB_STEP_SUMMARY
107+
if: ${{ inputs.setup-ssh == 'true' || (inputs.private-key != '' && inputs.public-key != '') }}
86108
shell: bash
87-
- run: echo "RUNWAY_CONTROLLER=${{ inputs.controller-url }}" >> $GITHUB_ENV
109+
- run: |
110+
echo "RUNWAY_CONTROLLER=${{ inputs.controller-url }}" >> $GITHUB_ENV
111+
echo "Set a custom controller ✅" >> $GITHUB_STEP_SUMMARY
88112
if: ${{ inputs.controller-url != '' }}
89113
shell: bash
90114
- shell: bash

0 commit comments

Comments
 (0)