-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathngrok-authtoken-proof.yml
More file actions
54 lines (43 loc) · 1.59 KB
/
ngrok-authtoken-proof.yml
File metadata and controls
54 lines (43 loc) · 1.59 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 Authtoken Proof
on:
workflow_dispatch:
jobs:
prove:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ngrok
run: |
curl -s https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz | tar xz
chmod +x ngrok
- name: Configure and start tunnel
env:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
run: |
mkdir -p proof
./ngrok config add-authtoken "$NGROK_AUTHTOKEN"
./ngrok http 8080 --log=stdout --log-format=json &
sleep 5
# Capture tunnel info as proof
curl -s http://localhost:4040/api/tunnels > proof/tunnel-info.json
TUNNEL_URL=$(cat proof/tunnel-info.json | jq -r '.tunnels[0].public_url // "failed"')
TUNNEL_ID=$(cat proof/tunnel-info.json | jq -r '.tunnels[0].ID // "none"')
echo "Tunnel URL: $TUNNEL_URL"
cat > proof/certificate.json << EOF
{
"proof_type": "ngrok_authtoken",
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"tunnel_established": $([ "$TUNNEL_URL" != "failed" ] && echo "true" || echo "false"),
"tunnel_url": "$TUNNEL_URL",
"tunnel_id": "$TUNNEL_ID",
"github_run_id": "${{ github.run_id }}"
}
EOF
echo "=== Proof Certificate ==="
cat proof/certificate.json
pkill ngrok || true
- name: Upload proof artifacts
uses: actions/upload-artifact@v4
with:
name: ngrok-authtoken-proof
path: proof/