GitHub Actions

Self-hosted runner

version: "3"
build:
  steps:
    - type: apt-get
      packages: ["build-essential", "curl", "git", "nano", "software-properties-common", "ssh", "sudo", "tar", "unzip", "vim", "wget", "zip"]
    - type: command
      command: |
        mkdir actions-runner && cd actions-runner
        curl -o actions-runner-linux-x64-2.317.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz
        tar xzf ./actions-runner-linux-x64-2.317.0.tar.gz
        ./config.sh --unattended --url https://github.com/OWNER/REPO --token <token> --labels devzero

# We have to specify a "launch" command that installs a systemd service
# and starts it in the background after the workspace has been created
launch:
  steps:
    - type: command
      command: |
        cd actions-runner
        ./svc.sh install && ./svc.sh start
      directory: /home/devzero
      user: root

Tip: Make sure to pass the --unattended flag to config.sh script.

Actions Runner Controller

Adjust the INSTALLATION_NAME, NAMESPACE, GITHUB_CONFIG_URL, and GITHUB_PAT variables as needed.

version: "3"
build:
  steps:
    - type: apt-get
      packages: ["build-essential", "curl", "git", "nano", "software-properties-common", "ssh", "sudo", "tar", "unzip", "vim", "wget", "zip"]
    - type: command
      command: |
        curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
        sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && rm kubectl
      directory: /home/devzero
      user: devzero
    - type: command
      command: |
        curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
        chmod 700 get_helm.sh
        ./get_helm.sh

launch:
  steps:
    - type: command
      command: |
        NAMESPACE=dz-arc-systems
        helm install arc \
            --namespace "${NAMESPACE}" \
            --create-namespace \
            oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
    - type: command
      command: |
        INSTALLATION_NAME="dz-runner-set"
        NAMESPACE="dz-arc-runners"
        GITHUB_CONFIG_URL=https://github.com/OWNER/REPO
        GITHUB_PAT=ghp_token
        helm install "${INSTALLATION_NAME}" \
            --namespace "${NAMESPACE}" \
            --create-namespace \
            --set githubConfigUrl="${GITHUB_CONFIG_URL}" \
            --set githubConfigSecret.github_token="${GITHUB_PAT}" \
            oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set

Last updated