GitHub Action
Hetzner Cloud Self-Hosted Runner for GitHub CI
v2
Latest version
Automatically start cloud instances in the Hetzner Cloud as self-hosted runners for GitHub repositories. These are started and stopped automatically before and after the GitHub CI run.
- Bootstrap your CI job to create a new hetzner instance:
jobs:
prepare_env:
runs-on: ubuntu-latest
name: Create new Hetzner Cloud instance for build
steps:
- uses: stonemaster/hetzner-github-runner@HEAD
with:
github-api-key: ${{ secrets.GH_API_KEY }}
hetzner-api-key: ${{ secrets.HETZNER_API_KEY }}
hetzner-instance-type: cx11
- After this step another workflow can run on this self-hosted machine. Note
that this job depends on
prepare_env
:
jobs:
[...]
actual_build:
runs-on: self-hosted
needs: prepare_env
steps:
- run: env
shell: bash
Never put the tokens into clear-text but use the Repository secrets feature of the GitHub CI
- The GitHub API Key provided should just have read/write permission to the Repository Administration. This is needed to obtain a new registration token for your repository that is needed by the GitHub runner.
- A Hetzner API key needs to be generated for your project according to the offical documentation.