/setup-cloudflared

🚛 Installs cloudflared for GitHub Actions

Primary LanguageShellMIT LicenseMIT

Setup Cloudflare Tunnel client

🚛 Installs cloudflared for GitHub Actions

📦 Downloads & installs the cloudflared binary
🚀 Zero-config — just add uses: debugci/setup-cloudflared@v1
⚠️ Only installs cloudflared — it's on you to use it
🌈 Works on Windows, macOS, and Linux runners

Usage

GitHub Actions GitHub

This action will download and install the Cloudflare Tunnel client (formerly Argo Tunnel) for GitHub Actions. To use it, all you need to do is add the following uses: block to your GitHub Actions steps. It even works on Windows runners!

- uses: debugci/setup-cloudflared@v1

Then after setting up your cloudflared installation with that action 👆 you can use the cloudflared binary anywhere in your program. For example, if you're manually testing some kind of web service inside of GitHub Actions, you may want to expose that via Cloudflare Quick Tunnels

# Starts a background process that will run EVEN AFTER this step completes.
# This is what you want if you're hosting a temp HTTP server in GitHub Actions.
- run: nohup cloudflared tunnel --url http://localhost:5000 &

📚 You can read more about all of the features of the Cloudflare Tunnel client on their documentation website.

Here's an example of npx serve being exposed to the world via cloudflared using GitHub Actions
on: workflow_dispatch
jobs:
  npx-serve:
    runs-on: ubuntu-latest
    steps:
      - uses: debugci/setup-cloudflared@v1
      - run: nohup npx -y serve &
      - run: nohup cloudflared tunnel --url http://localhost:3000 &
      - run: echo 'To stop the server, click CANCEL in the workflow/job'
      - run: sleep 1h

Options

There's only one option so far. If you want to see automatic login or similar, just open an Issue! ❤️

  • cloudflared-version: Specifies which version of the cloudflared binary to install from the GitHub Releases page. Note that this is not your typical v1.2.3 version string; instead Cloudflare uses a v2023.1.1 date-based versioning scheme. The default value for this field is latest which will automagically default to the latest GitHub Release.

Development

GNU Bash

This GitHub Action is relatively simple. As such, it's currently Bash-based to keep things simple. To test the action, we use GitHub Actions (actions-ception!). To get started, just fork/clone the repo and make a PR! All PRs automatically run various use examples to make sure that the action "works" for basic stuff.