Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup cloudflared for GitHub Actions

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.)

Usage

  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.
  2. At the config.yaml, set credentials-file: to /home/runner/.cloudflared/<cloudflare-tunnel-id>.json
  3. Encode the config.yaml in base64 using this command base64 -w 0 config.yaml and paste it to CLOUDFLARE_TUNNEL_CONFIGURATION secret.
  4. Add the Cloudflare Tunnel ID to CLOUDFLARE_TUNNEL_ID secret.

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@v1

If 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 || true

Example config.yaml file

url: http://localhost:8080
tunnel: deadbeef-1234-4321-abcd-123456789abc
credentials-file: /home/runner/.cloudflared/deadbeef-1234-4321-abcd-123456789abc.json

Similar actions

  1. vmactions/cf-tunnel
  2. apogiatzis/ngrok-tunneling-action
  3. vmactions/ngrok-tunnel

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages