Setup Cloudflare Tunnel client for GitHub Actions.
This action installs cloudflared for use in actions by installing it on tool cache using AnimMouse/tool-cache.
This action will automatically sign in and start Cloudflare Tunnel.
Other virtual environments besides Ubuntu are not supported yet.
Test page for setup-cloudflared (This will only work when the test action is running.)
- Encode the JSON credential in base64 using this command
base64 -w 0 <cloudflare-tunnel-id>.jsonand paste it toCLOUDFLARE_TUNNEL_CREDENTIALsecret. - At the config.yaml, set
credentials-file:to/home/runner/.cloudflared/<cloudflare-tunnel-id>.json - Encode the config.yaml in base64 using this command
base64 -w 0 config.yamland paste it toCLOUDFLARE_TUNNEL_CONFIGURATIONsecret. - Add the Cloudflare Tunnel ID to
CLOUDFLARE_TUNNEL_IDsecret.
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.
The Shutdown Cloudflare Tunnel action should have if: always() so that it will run even if the workflow failed or canceled.
steps:
- name: Setup Cloudflare Tunnel
uses: AnimMouse/setup-cloudflared@v1
with:
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
cloudflare_tunnel_configuration: ${{ secrets.CLOUDFLARE_TUNNEL_CONFIGURATION }}
cloudflare_tunnel_id: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
- name: Start Python HTTP server
run: timeout 5m python -m http.server 8080 || true
- name: Shutdown and view logs of Cloudflare Tunnel
if: always()
uses: AnimMouse/setup-cloudflared/shutdown@v1If you don't want to autostart Cloudflare Tunnel, set autostart: to false.
steps:
- name: Setup Cloudflare Tunnel
uses: AnimMouse/setup-cloudflared@v1
with:
cloudflare_tunnel_credential: ${{ secrets.CLOUDFLARE_TUNNEL_CREDENTIAL }}
cloudflare_tunnel_configuration: ${{ secrets.CLOUDFLARE_TUNNEL_CONFIGURATION }}
cloudflare_tunnel_id: ${{ secrets.CLOUDFLARE_TUNNEL_ID }}
autostart: false
- name: Manually start Cloudflare Tunnel
run: timeout 5m cloudflared tunnel run || trueurl: http://localhost:8080
tunnel: deadbeef-1234-4321-abcd-123456789abc
credentials-file: /home/runner/.cloudflared/deadbeef-1234-4321-abcd-123456789abc.json