Github Actions Self-Hosted Runners 自托管运行程序

设置仓库

Settings -> Actions -> Runners -> New self-hosted runner

  • Runner image: Linux
  • Architecture: x64

Register Runner

./config.sh --name <name> --url <repo_url> --token <token>
## 后台运行并输出日志到run.log
./run.sh > run.log 2>&1 &

测试Github workflow

  • 创建.github/workflows/ci.yaml
  • 注: runs-on: self-hosted
name: ci on self-hosted runners

on:
  workflow_dispatch:

defaults:
  run:
    shell: bash

jobs:
  build:
    runs-on: self-hosted
    steps:
      - name: hello world
        run: echo "hello"