-
Notifications
You must be signed in to change notification settings - Fork 7
/
action.yml
50 lines (44 loc) · 1.54 KB
/
action.yml
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
name: 'Ngrok Tunnel Action'
description: 'Tunnel traffic from within a Github Action runner'
branding:
icon: 'compass'
color: 'red'
inputs:
timeout:
description: 'Ngrok tunnel deployment timeout'
default: '1h'
tunnel_type:
description: 'Type of Ngrok tunnel, tcp or http'
required: true
default: 'tcp'
port:
description: 'The port to forward traffic to'
required: true
save_url_to_filename:
description: 'Save the deployed tunnel URL to a file with the provided name'
ngrok_authtoken:
description: 'Ngrok authorization token'
required: true
outputs:
tunnel-url:
description: "Deployed Ngrok tunnel URL"
value: ${{ steps.print-tunnel-url.outputs.tunnel-url }}
runs:
using: "composite"
steps:
- run: wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
shell: bash
- run: unzip -qq ngrok-stable-linux-amd64.zip
shell: bash
- run: ./ngrok authtoken ${{ inputs.ngrok_authtoken }}
shell: bash
- run: ( timeout ${{ inputs.timeout }} ./ngrok ${{ inputs.tunnel_type }} ${{ inputs.port }} ) &
shell: bash
- id: print-tunnel-url
run: echo "::set-output name=tunnel-url::$( curl http://127.0.0.1:4040/api/tunnels | jq -r ".tunnels[0].public_url" )"
shell: bash
- run: echo ${{ steps.print-tunnel-url.outputs.tunnel-url }}
shell: bash
- if: "${{ inputs.save_url_to_filename != '' }}"
run: echo ${{ steps.print-tunnel-url.outputs.tunnel-url }} > ${{ inputs.save_url_to_filename }}
shell: bash