Skip to content

Commit f503d54

Browse files
committed
Update: initial release hostwithquantum/setup-runway
1 parent 474bf42 commit f503d54

File tree

2 files changed

+150
-2
lines changed

2 files changed

+150
-2
lines changed

README.md

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,107 @@
1-
# runway-action
2-
A GitHub action to deploy to runway!
1+
# hostwithquantum/setup-runway
2+
3+
A GitHub action to setup the runway CLI! Questions, issues? Please use discussions or the issue tracker on the repository. If you like what you see here, **we appreciate a** :star: and if you'd subscribe to [(our monthly) mailing list](https://runway.planetary-quantum.com/) to stay in the loop!
4+
5+
## Options
6+
7+
Currently supported options:
8+
9+
| option | default value | description |
10+
|---------------|---------------|-------------------------------------------|
11+
| username | `<none>` | username/email for runway |
12+
| password | `<none>` | password for runway |
13+
| public-key | `<none>` | use this to add a new key to your account |
14+
| download-link | ... | this is a link to our S3-storage |
15+
| log-level | `error` | debug, info, warn, error |
16+
| version | `latest` | will be added before `v1` |
17+
18+
> Since we are pre-1.0, latest is fine. We still do not want to break your workflows. But sometimes BC breaks are necessary. Because they usually involve our client and APIs, using latest helps to keep all interruptions to a minimum.
19+
20+
## Examples
21+
22+
### Setup the runway CLI
23+
24+
This is an example how to setup the runway CLI and then how to deploy your app `cool-app`.
25+
26+
Once you have the client setup, you can run commands and play around with output and so on. To keep it simple, we're only deploying the code. :) Since the app exists already on runway we use the `runway gitremote` command to initialize the setup.
27+
28+
```yaml
29+
# .github/workflows/release.yml
30+
---
31+
name: release
32+
33+
on:
34+
push:
35+
tags:
36+
37+
jobs:
38+
deploy:
39+
runs-on: ubuntu-latest
40+
env:
41+
YOUR_APPLICATION_NAME: cool-app
42+
steps:
43+
- uses: actions/checkout@v3
44+
- name: create public/private key on GHA
45+
run: |
46+
mkdir -p ~/.ssh/
47+
echo ${{ secrets.PRIVATE_KEY }} > ~/.ssh/id_rsa
48+
echo ${{ secrets.PUBLIC_KEY }} > ~/.ssh/id_rsa.pub
49+
chmod 0600 ~/.ssh/id_rsa*
50+
- uses: hostwithquantum/[email protected]
51+
with:
52+
username: ${{ secrets.RUNWAY_USERNAME }}
53+
password: ${{ secrets.RUNWAY_PASSWORD }}
54+
- run: runway -y gitremote -a ${YOUR_APPLICATION_NAME}
55+
- run: runway -y app deploy
56+
```
57+
58+
### Running e2e tests
59+
60+
GitHub Actions provides a robust and comprehensive environment. In the following workflow we leverage some of its context in form of `${{ github.run_id }} to deploy your app with a unique name. Once deployed, you can run end-to-end tests against it and in the end, shut it down by deleting the app (and key). :)
61+
62+
```yaml
63+
# .github/workflows/e2e.yml
64+
---
65+
name: e2e
66+
67+
on:
68+
pull_request:
69+
70+
jobs:
71+
deploy_app:
72+
runs-on: ubuntu-latest
73+
timeout-minutes: 15
74+
env:
75+
RUNWAY_LOGLEVEL: info
76+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
77+
steps:
78+
- uses: actions/checkout@v3
79+
- name: create an ssh key just for this run
80+
run: |
81+
mkdir -p ~/.ssh/
82+
ssh-keygen -b 2048 -t rsa -f ~/.ssh/test-runner -c "test-key-${{ github.run_id }}" -q -N ""
83+
- run: |
84+
ssh-keyscan -p 2222 api-builder.staging.pqapp.dev >> ~/.ssh/known_hosts
85+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
86+
ssh-add ~/.ssh/test-runner
87+
- name: install CLI, login and add ssh key
88+
uses: hostwithquantum/[email protected]
89+
with:
90+
username: ${{ secrets.RUNWAY_USERNAME }}
91+
password: ${{ secrets.RUNWAY_PASSWORD }}
92+
public-key: ~/.ssh/test-runner.pub
93+
- name: create app on runway (with a **unique name**)
94+
run: runway -y app create -a my-cool-app-${{ github.run_id }}
95+
- name: deploy your app to runway
96+
run: runway -y app deploy
97+
# this is where your tests run!
98+
- name: run your e2e tests here
99+
run: curl https://my-cool-app-${{ github.run_id }}.staging.pqapp.dev/
100+
# then hopefully you are done :)
101+
- name: cleanup app
102+
if: always()
103+
run : runway -y app rm -a my-cool-app-${{ github.run_id }} || true
104+
- name: cleanup key - this is brute force
105+
if: always()
106+
run: runway -y key rm "test-key-${{ github.run_id }}" || true
107+
```

action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: 'hostwithquantum/setup-runway'
3+
description: 'Setup the runway CLI on GitHub Actions'
4+
branding:
5+
icon: 'zap'
6+
color: 'yellow'
7+
inputs:
8+
username:
9+
required: true
10+
description: runway account
11+
password:
12+
required: true
13+
description: runway password
14+
public-key:
15+
description: ssh (public) key
16+
required: false
17+
download-link:
18+
description: 'Download link for runway CLI'
19+
required: true
20+
default: 'https://s3.storage.planetary-networks.de/download.staging.pqapp.dev/runway/latest/runway_linux_amd64'
21+
log-level:
22+
description: debug, info, warn, error
23+
default: error
24+
required: true
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: install runway cli
29+
run: |
30+
curl \
31+
${{ inputs.download-link }} \
32+
-o ${{ github.action_path }}/runway \
33+
&& chmod +x ${{ github.action_path }}/runway
34+
shell: bash
35+
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
36+
shell: bash
37+
- run: runway -v -q
38+
shell: bash
39+
- run: runway -l ${{ inputs.log-level }} -y -q login -u ${{ inputs.username }} -p ${{ inputs.password }}
40+
shell: bash
41+
- run: runway -l ${{ inputs.log-level }} -q -y key create ${{ inputs.public-key }}
42+
if: "${{ inputs.public-key != '' }}"
43+
shell: bash

0 commit comments

Comments
 (0)