Skip to main content

Run CI on self-hosted GitHub Actions runners

10 min tutorial

What you'll build​

Autoscaling GitHub Actions runners registered to your GitHub org and running on SonicInfra compute, plus a workflow that builds your app and deploys it to a compute instance over SSH — all running on your own infrastructure instead of GitHub's hosted runners.

Prerequisites​

  • A SonicInfra account with billing enabled.
  • Admin access to a GitHub organization.
  • A running compute instance to deploy to — see Deploy your first compute instance if you don't have one yet.
Show me!

Open GitHub Action Runner Sets

Click GitHub Action Runner Sets in the sidebar.

Create a new runner set

Click + Create GitHub Action Runner Set.

Before you create it

Runner sets provision compute VMs to run your jobs — your organization needs billing set up before you can create one.

tip

Haven't set up billing yet? Here's how to add a payment method first.

Configure the runner set

Fill in the fields, then click Create GitHub Action Runner Set:

  • Name — used later to target this runner set from a workflow. Use ci-runners for this tutorial.
  • GitHub Org — the GitHub organization these runners register to. Use an org you're an admin of.
  • Min Runners / Max Runners — the pool autoscales between these bounds as jobs queue up. 0–5 is a reasonable starting range.
  • VM Config — cores, memory, and base image for each runner VM. This is a separate image catalog from Compute Instances — use a container disk image like ubuntu:22.04, not a Compute Instance image slug.

Wait for the runner set to come up

Click its row to open the details panel and confirm Ready is true. This can take a couple of minutes the first time, while the runner VMs boot and register with GitHub.

Target it from a workflow

Point a job at your runner set with runs-on, using the Name you gave it instead of ubuntu-latest:

jobs:
build-and-deploy:
runs-on: ci-runners

Unlike GitHub's traditional self-hosted runner labels, this is a single scale-set name, not a list of labels — GitHub Actions Runner Controller (which powers this resource) routes jobs to the pool by that exact name.

Build and deploy from the runner

Put it together into a workflow that builds your app and deploys it to a compute instance over SSH, the same way you would by hand — just triggered by a push instead of a person at a terminal. Replace web-01 below with your own instance's name:

name: Deploy
on:
push:
branches: [main]

jobs:
build-and-deploy:
runs-on: ci-runners
steps:
- uses: actions/checkout@v4

- name: Install and build
run: |
npm ci
npm run build

- name: Deploy over SSH
run: |
sonic ssh web-01 -- 'cd your-app && git pull && npm ci && npm run build && sudo systemctl restart your-app'
tip

Your runner VMs already live on SonicInfra's private network, so sonic ssh reaches your instance the same way it does from your laptop — no public IP or extra network setup needed.

Next steps​