Skip to content

Commit 3826b8b

Browse files
committed
docs: Update README.md to v2
1 parent fa1621a commit 3826b8b

File tree

1 file changed

+67
-35
lines changed

1 file changed

+67
-35
lines changed

README.md

+67-35
Original file line numberDiff line numberDiff line change
@@ -3,82 +3,115 @@ Setup [Cloudflare Tunnel client](https://github.com/cloudflare/cloudflared) for
33

44
This action installs [cloudflared](https://github.com/cloudflare/cloudflared) for use in actions by installing it on tool cache using [AnimMouse/tool-cache](https://github.com/AnimMouse/tool-cache).
55

6-
This action will automatically sign in and start Cloudflare Tunnel.
7-
8-
This GitHub action participated on [GitHub Actions Hackathon 2021](https://dev.to/animmouse/expose-your-web-server-on-github-actions-to-the-internet-using-cloudflare-tunnel-ego), but sadly, it lost.
6+
This GitHub action participated in the [GitHub Actions Hackathon 2021](https://dev.to/animmouse/expose-your-web-server-on-github-actions-to-the-internet-using-cloudflare-tunnel-ego), but sadly, it lost.
97

108
Test page for setup-cloudflared: https://setup-cloudflared.44444444.xyz (This will only work when the test action is running.)
119

1210
## Usage
11+
To use `cloudflared`, run this action before `cloudflared`.
12+
13+
```yaml
14+
steps:
15+
- name: Setup cloudflared
16+
uses: AnimMouse/setup-cloudflared@v2
17+
18+
- name: Check cloudflared version
19+
run: cloudflared -v
20+
```
21+
22+
### Cloudflare Tunnel Usage
23+
Use Cloudflare Tunnel to expose servers running inside GitHub Actions to the Internet.
24+
1325
1. Encode the JSON credential in Base64 using this command `base64 -w 0 <cloudflare-tunnel-id>.json` and paste it to `CLOUDFLARE_TUNNEL_CREDENTIAL` secret.
14-
2. At the config.yaml, set `credentials-file:` to:
26+
2. Inside the config.yaml, set `credentials-file:` to:
1527
1. Ubuntu: `/home/runner/.cloudflared/<cloudflare-tunnel-id>.json`
1628
2. Windows: `C:\Users\runneradmin\.cloudflared\<cloudflare-tunnel-id>.json`
1729
3. macOS: `/Users/runner/.cloudflared/<cloudflare-tunnel-id>.json`
18-
3. Encode the config.yaml in Base64 using this command `base64 -w 0 config.yaml` and paste it to `CLOUDFLARE_TUNNEL_CONFIGURATION` secret.
19-
4. Add the Cloudflare Tunnel ID to `CLOUDFLARE_TUNNEL_ID` secret.
30+
3. Encode the config.yaml in Base64 using this command `base64 -w 0 config.yaml` and paste it to `CLOUDFLARE_TUNNEL_CONFIGURATION` variable.
31+
4. Add the Cloudflare Tunnel ID to `CLOUDFLARE_TUNNEL_ID` variable.
2032

2133
To gracefully shutdown Cloudflare Tunnel after being started in the background, use the `AnimMouse/setup-cloudflared/shutdown` action as composite actions does not support `post:` yet.\
22-
The `Shutdown Cloudflare Tunnel` action should have `if: always()` so that it will run even if the workflow failed or canceled.
34+
The `Shutdown Cloudflare Tunnel` action should have `if: '! cancelled()'` so that it will run even if the workflow fails.
2335
2436
```yaml
2537
steps:
2638
- name: Setup cloudflared
27-
uses: AnimMouse/setup-cloudflared@v1
39+
uses: AnimMouse/setup-cloudflared@v2
40+
41+
- name: Setup cloudflared tunnel
42+
uses: AnimMouse/setup-cloudflared/tunnel@v2
2843
with:
2944
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
30-
cloudflare_tunnel_configuration: ${{ secrets.CLOUDFLARE_TUNNEL_CONFIGURATION }}
31-
cloudflare_tunnel_id: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
45+
cloudflare_tunnel_configuration: ${{ vars.CLOUDFLARE_TUNNEL_CONFIGURATION }}
46+
cloudflare_tunnel_id: ${{ vars.CLOUDFLARE_TUNNEL_ID }}
3247

33-
- name: Start Python HTTP server
34-
run: timeout 5m python -m http.server 8080 || true
35-
36-
- name: Shutdown and view logs of cloudflared
37-
if: always()
38-
uses: AnimMouse/setup-cloudflared/shutdown@v1
48+
- name: Start Python HTTP server
49+
run: timeout 5m python -m http.server 8080 || true
50+
51+
- name: Shutdown and view logs of cloudflared
52+
if: '! cancelled()'
53+
uses: AnimMouse/setup-cloudflared/shutdown@v2
3954
```
4055
41-
If you don't want to autostart Cloudflare Tunnel, set `autostart:` to `false`.
56+
If you don't want to automatically start Cloudflare Tunnel in the background, set `autostart:` to `false`.
4257

4358
```yaml
4459
steps:
4560
- name: Setup cloudflared
46-
uses: AnimMouse/setup-cloudflared@v1
61+
uses: AnimMouse/setup-cloudflared@v2
62+
63+
- name: Setup cloudflared tunnel
64+
uses: AnimMouse/setup-cloudflared/tunnel@v2
4765
with:
4866
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
49-
cloudflare_tunnel_configuration: ${{ secrets.CLOUDFLARE_TUNNEL_CONFIGURATION }}
50-
cloudflare_tunnel_id: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
67+
cloudflare_tunnel_configuration: ${{ vars.CLOUDFLARE_TUNNEL_CONFIGURATION }}
68+
cloudflare_tunnel_id: ${{ vars.CLOUDFLARE_TUNNEL_ID }}
5169
autostart: false
5270
53-
- name: Manually start cloudflared
54-
run: timeout 5m cloudflared tunnel run || true
71+
- name: Manually start cloudflared tunnel
72+
run: timeout 5m cloudflared tunnel run || true
73+
```
74+
75+
### TryCloudflare Usage
76+
You can use Cloudflare Tunnel without a Cloudflare account and a domain name. Your quick tunnel URL will appear on the Actions log.
77+
78+
```yaml
79+
steps:
80+
- name: Setup cloudflared
81+
uses: AnimMouse/setup-cloudflared@v2
82+
83+
- name: Setup cloudflared tunnel
84+
uses: AnimMouse/setup-cloudflared/tunnel@v2
85+
with:
86+
url: http://localhost:8080
87+
88+
- name: Start Python HTTP server
89+
run: timeout 5m python -m http.server 8080 || true
90+
91+
- name: Shutdown and view logs of cloudflared
92+
if: '! cancelled()'
93+
uses: AnimMouse/setup-cloudflared/shutdown@v2
5594
```
5695

5796
### Specific version
58-
You can specify the version you want. By default, this action downloads the latest version if version is not specified.
97+
You can specify the version you want. By default, this action downloads the latest version if the version is not specified.
5998

6099
```yaml
61100
steps:
62101
- name: Setup cloudflared
63-
uses: AnimMouse/setup-cloudflared@v1
102+
uses: AnimMouse/setup-cloudflared@v2
64103
with:
65-
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
66-
cloudflare_tunnel_configuration: ${{ secrets.CLOUDFLARE_TUNNEL_CONFIGURATION }}
67-
cloudflare_tunnel_id: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
68-
version: 2023.8.1
104+
version: 2024.2.1
69105
```
70106

71107
### GitHub token
72-
This action automatically uses a GitHub token in order to authenticate with GitHub API and avoid rate limiting. You can also specify your own read-only fine-grained personal access token.
108+
This action automatically uses a GitHub token in order to authenticate with the GitHub API and avoid rate limiting. You can also specify your own read-only fine-grained personal access token.
73109

74110
```yaml
75111
steps:
76112
- name: Setup cloudflared
77-
uses: AnimMouse/setup-cloudflared@v1
113+
uses: AnimMouse/setup-cloudflared@v2
78114
with:
79-
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
80-
cloudflare_tunnel_configuration: ${{ secrets.CLOUDFLARE_TUNNEL_CONFIGURATION }}
81-
cloudflare_tunnel_id: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
82115
token: ${{ secrets.GH_PAT }}
83116
```
84117

@@ -107,5 +140,4 @@ credentials-file: /Users/runner/.cloudflared/deadbeef-1234-4321-abcd-123456789ab
107140
### Similar actions
108141
1. [vmactions/cf-tunnel](https://github.com/vmactions/cf-tunnel)
109142
2. [apogiatzis/ngrok-tunneling-action](https://github.com/apogiatzis/ngrok-tunneling-action)
110-
3. [vmactions/ngrok-tunnel](https://github.com/vmactions/ngrok-tunnel)
111-
4. [debugci/setup-cloudflared](https://github.com/debugci/setup-cloudflared)
143+
3. [vmactions/ngrok-tunnel](https://github.com/vmactions/ngrok-tunnel)

0 commit comments

Comments
 (0)