forked from Nasfame/github-actions-ngrok
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
54 lines (48 loc) · 1.76 KB
/
action.yml
File metadata and controls
54 lines (48 loc) · 1.76 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
name: 'Ngrok Github Action'
description: 'In Github Runner: tunnel local ports to public URLs and inspect traffic via ngrok'
author: 'Nasfame'
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: |
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \
sudo tee /etc/apt/sources.list.d/ngrok.list && \
sudo apt update && sudo apt install ngrok
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