-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
58 lines (56 loc) · 2.32 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
51
52
53
54
55
56
57
58
name: "Expose Tunnel"
description: "Easily create tunnels to access your GitHub Action workflows from public endpoints"
inputs:
service:
required: true
description: Which tunneling service to use
port:
required: true
description: The local port we are creating a tunnel to
selfHostedEndpoint:
required: false
description: No, unless `bore.selfhosted` was specified as the `service`
secret:
required: false
description: Set a secret to be used for services that support it
fallback:
required: false
description: Fallback strategy if the preferred `service` isn't available (e.g. self-hosted is down, fallback to managed service)
blocking:
required: false
description: If the step should block and keep the job alive for the specified amount of time. This means you won't be able to use the output in later steps since the tunnel will be closing after the step.
outputs:
tunnel-url:
description: "The tunnel url that exposes the local service"
value: ${{ steps.setup-tunnel.outputs.tunnel-url }}
branding:
icon: message-circle
color: purple
runs:
using: "composite"
steps:
- run: |
# Start the tunneling process in the background.
node ${{ github.action_path }}/dist/index.js > /tmp/expose-tunnel.log 2>&1 &
id: setup-tunnel
# We manually set the input since we are using a composite step.
env:
INPUT_SERVICE: ${{ inputs.service }}
INPUT_PORT: ${{ inputs.port }}
INPUT_SELFHOSTEDENDPOINT: ${{ inputs.selfHostedEndpoint }}
INPUT_SECRET: ${{ inputs.secret }}
INPUT_FALLBACK: ${{ inputs.fallback }}
INPUT_BLOCKING: ${{ inputs.blocking }}
shell: bash
# Wait for it to have set the tunnel url and be done.
- run: |
timeout 30s bash -c 'until [ -f /tmp/expose-tunnel/.tunnel-is-ready ]; do sleep 1; echo "Waiting for /tmp/expose-tunnel/.tunnel-is-ready to be ready..."; done;'
# To ensure the output has been correctly picked up (sometimes it can race-condition), we
# wait an additional second.
cat /tmp/expose-tunnel.log
echo ">> Tunnel url stored in output: '${{ steps.setup-tunnel.outputs.tunnel-url }}'"
sleep 1
shell: bash
- run: timeout ${{ inputs.blocking }} sleep 7200
if: inputs.blocking && inputs.blocking != ''
shell: bash