-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
130 lines (130 loc) · 4.57 KB
/
action.yml
File metadata and controls
130 lines (130 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
name: 'hostwithquantum/setup-runway'
description: 'Setup the runway CLI on GitHub Actions'
branding:
icon: 'zap'
color: 'yellow'
inputs:
username:
required: true
description: Runway account
password:
required: true
description: Runway password
application:
required: false
description: Runway application
public-key:
description: ssh public key (secret)
required: false
private-key:
description: ssh private key (secret)
required: false
public-key-location:
description: ssh public key location
required: true
default: "~/.ssh/id_rsa.pub"
private-key-location:
description: ssh private key location
required: true
default: "~/.ssh/id_rsa"
add-key:
description: if set to true, run "runway key create"
required: true
default: 'false'
setup-ssh:
description: if set to true, setup ssh to work for "runway app deploy"
default: 'false'
log-level:
description: debug, info, warn, error
default: error
required: true
version:
description: runway cli version
default: "latest"
required: true
controller-url:
description: Custom controller URL (for testing + enterprise)
required: false
runs:
using: "composite"
steps:
- run: |
echo "RUNWAY_CONTROLLER=${{ inputs.controller-url }}" >> $GITHUB_ENV
echo "Set a custom controller ✅" >> $GITHUB_STEP_SUMMARY
if: ${{ inputs.controller-url != '' }}
shell: bash
- name: setup your ssh public and private key
shell: bash
if: ${{ inputs.private-key != '' && inputs.public-key != '' }}
run: |
mkdir -p ~/.ssh/
echo "${{ inputs.private-key }}" > ${{ inputs.private-key-location }}
echo "${{ inputs.public-key }}" > ${{ inputs.public-key-location }}
chmod 0600 ${{ inputs.private-key-location }}
chmod 0600 ${{ inputs.public-key-location }}
echo "SSH keys added ✅" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo " - public key in ${{ inputs.public-key-location }}" >> $GITHUB_STEP_SUMMARY
echo " - private key in ${{ inputs.private-key-location }}" >> $GITHUB_STEP_SUMMARY
- shell: bash
run: |
ARCH=$(uname -m)
case $ARCH in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
esac
echo "RUNWAY_ARCH=$ARCH" >> $GITHUB_ENV
- name: install runway cli
run: |
curl \
-H 'Cache-Control: no-cache' \
"https://download.runway.horse/runway/${{ inputs.version }}/runway_linux_${RUNWAY_ARCH}?nocache=$(date +%s)" \
-o ${{ github.action_path }}/runway \
&& chmod +x ${{ github.action_path }}/runway
shell: bash
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
shell: bash
- name: "Configure how Runway behaves"
run: |
echo "RUNWAY_NONINTERACTIVE=true" >> $GITHUB_ENV
echo "RUNWAY_LOGLEVEL=${{ inputs.log-level }}" >> $GITHUB_ENV
echo "RUNWAY_OUTPUT=quiet" >> $GITHUB_ENV
shell: bash
- shell: bash
run: |
runway -v
echo "Installed Runway CLI ✅" >> $GITHUB_STEP_SUMMARY
- shell: bash
run: |
runway login -u "${{ inputs.username }}" -p "${{ inputs.password }}"
echo "Logged in successfully ✅" >> $GITHUB_STEP_SUMMARY
- if: ${{ inputs.add-key == 'true' }}
shell: bash
run: |
runway key create ${{ inputs.public-key-location }}
echo "Imported a new key ✅" >> $GITHUB_STEP_SUMMARY
- if: ${{ inputs.application != '' }}
shell: bash
run: |
if runway app show -a "${{ inputs.application }}" >/dev/null 2>&1; then
runway gitremote -a "${{ inputs.application }}"
echo "Attached to application: ${{ inputs.application }} ✅" >> $GITHUB_STEP_SUMMARY
else
echo "Application does not exist..."
runway app create -a "${{ inputs.application }}"
echo "Created new application: ${{ inputs.application }} ✅" >> $GITHUB_STEP_SUMMARY
fi
- env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
ssh-keyscan -p 2222 deploy.runway.horse >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add ${{ inputs.private-key-location }}
echo "ssh setup complete ✅" >> $GITHUB_STEP_SUMMARY
if: ${{ inputs.setup-ssh == 'true' || (inputs.private-key != '' && inputs.public-key != '') }}
shell: bash
- shell: bash
run: |
echo "Let's deploy something?! 🚀🤘" >> $GITHUB_STEP_SUMMARY