Windows 相較於 macOS 和 Linux 設置較為繁瑣
在 Windows 上設定 GitHub Actions Runner 需要額外的權限與步驟。請先 以管理員身份 開啟 PowerShell,然後執行以下指令:
下載並安裝 GitHub Actions Runner
# 回到 C:\
cd ..\..\
# 創建一個文件夾
mkdir actions-runner; cd actions-runner
# 下載最新的runner包
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.322.0/actions-runner-win-x64-2.322.0.zip -OutFile actions-runner-win-x64-2.322.0.zip
# 可選:驗證哈希值
if((Get-FileHash -Path actions-runner-win-x64-2.322.0.zip -Algorithm SHA256).Hash.ToUpper() -ne 'ace5de018c88492ca80a2323af53ff3f43d2c82741853efb302928f250516015'.ToUpper()){ throw 'Computed checksum did not match' }
# 解壓安裝程序
Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.322.0.zip", "$PWD")
# 配置 GitHub Actions runner
# 接著填入需要配置的設定即可
./config.cmd --url https://github.com/YourOrganization --token yourToken