-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
40 lines (40 loc) · 2.07 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: 'Hetzner Cloud Self-Hosted Runner for GitHub CI'
description: 'Automatically start cloud instances in the Hetzner Cloud as self-hosted runners for GitHub repositories.'
inputs:
hetzner-api-key:
description: 'API key for the Hetzner Cloud'
required: true
hetzner-instance-type:
description: 'Name of Hetzner instance type to be created e.g. cx11. See https://docs.hetzner.cloud/#server-types-get-all-server-types'
required: true
hetzner-location:
description: 'Location ID where cloud instance should be created. In case of `auto` the Hetzner API will decide'
default: 'auto'
hetzner-ssh-key-id:
description: If set deploys this SSH key ID to the server for debugging purposes
required: false
hetzner-name-prefix:
description: 'Prefix for random generated server names'
default: 'github-ci-runner'
github-api-key:
description: 'GitHub API key that is needed to register a new self-hosted runner'
required: true
runs:
using: "composite"
steps:
- name: Generate GitHub runner token
id: create-github-runner-token
run: echo "github_runner_token=$(${{ github.action_path }}/create-github-runner-token.sh ${{ github.repository }} ${{ inputs.github-api-key }})" >> $GITHUB_OUTPUT
shell: bash
- name: Make sure that temp is created
run: mkdir -p ${{ runner.temp }}
shell: bash
- name: Generate cloud-init.yml
run: ${{ github.action_path }}/prepare-cloud-init.sh "${{ github.server_url }}/${{ github.repository }}" ${{ steps.create-github-runner-token.outputs.github_runner_token }} ${{ inputs.hetzner-api-key }} ${{ runner.temp }}/hetzner-ci-cloud-init.yml
shell: bash
- name: Create instance in the Hetzner Cloud
run: ${{ github.action_path }}/create-hetzner-instance.sh ${{ inputs.hetzner-api-key }} ${{ inputs.hetzner-instance-type }} ${{ inputs.hetzner-location }} ${{ inputs.hetzner-name-prefix }} ${{ runner.temp }}/hetzner-ci-cloud-init.yml ${{ inputs.hetzner-ssh-key-id}}
shell: bash
- name: Cleanup
run: rm ${{ runner.temp }}/hetzner-ci-cloud-init.yml
shell: bash