Windows Server 2022 Github Self-hosted 設定を行う方法

Windows Server

GitHubのクラウドホストされたランナーの代わりに自己ホストされたランナーを使用してビルド、テスト、およびデプロイの作業を実行できるようにします。

Self-hostedランナーを設置

PS C:\> mkdir actions-runner; cd actions-runner                                                                                                                           ディレクトリ: C:\                                                                                                                                                                                                                                                                                                                                                   Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2024/04/27      2:40                actions-runner
PS C:\actions-runner> Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.316.0/actions-runner-win-x64-2.316.0.zip -OutFile actions-runner-win-x64-2.316.0.zip
PS C:\actions-runner> if((Get-FileHash -Path actions-runner-win-x64-2.316.0.zip -Algorithm SHA256).Hash.ToUpper() -ne '9b2d0443d11ce5c2c4391d708576dc37b1ecf62edcceec7c0c9c8e6b4472b5a1'.ToUpper()){ throw 'Computed checksum did not match' }
PS C:\actions-runner> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.316.0.zip", "$PWD")
PS C:\actions-runner>./config.cmd --url https://github.com/zinnunkebi/tinypython --token ATMDMB7BVUREK2GS56WRVATGFPTXC
--------------------------------------------------------------------------------
|        ____ _ _   _   _       _          _        _   _                      |
|       / ___(_) |_| | | |_   _| |__      / \   ___| |_(_) ___  _ __  ___      |
|      | |  _| | __| |_| | | | | '_ \    / _ \ / __| __| |/ _ \| '_ \/ __|     |
|      | |_| | | |_|  _  | |_| | |_) |  / ___ \ (__| |_| | (_) | | | \__ \     |
|       \____|_|\__|_| |_|\__,_|_.__/  /_/   \_\___|\__|_|\___/|_| |_|___/     |
|                                                                              |
|                       Self-hosted runner registration                        |
|                                                                              |
--------------------------------------------------------------------------------
# Authentication
√ Connected to GitHub
# Runner Registration
Enter the name of the runner group to add this runner to: [press Enter for Default] Enter
Enter the name of runner: [press Enter for S-WIN22-221] Enter
This runner will have the following labels: 'self-hosted', 'Windows', 'X64'
Enter any additional labels (ex. label-1,label-2): [press Enter to skip] Enter
√ Runner successfully added
√ Runner connection is good
# Runner settings
Enter name of work folder: [press Enter for _work] Enter
√ Settings Saved.
Would you like to run the runner as service? (Y/N) [press Enter for N] Y
User account to use for the service [press Enter for NT AUTHORITY\NETWORK SERVICE]
Granting file permissions to 'NT AUTHORITY\NETWORK SERVICE'.
Service actions.runner.zinnunkebi-tinypython.S-WIN22-221 successfully installed
Service actions.runner.zinnunkebi-tinypython.S-WIN22-221 successfully set recovery option
Service actions.runner.zinnunkebi-tinypython.S-WIN22-221 successfully set to delayed auto start
Service actions.runner.zinnunkebi-tinypython.S-WIN22-221 successfully configured
Waiting for service to start...
Service actions.runner.zinnunkebi-tinypython.S-WIN22-221 started successfully
PS C:\actions-runner>

Self-hostedを削除

以下のように削除

PS C:\actions-runner> ./config.cmd remove --token TTMDMB7BVUREM2GX56WSVATOPPTXC
# Runner removal
Removing service
Waiting for service to stop...
√ Runner service removed
√ Runner removed successfully
√ Removed .credentials
√ Removed .runner

タイトルとURLをコピーしました