GitHub action is set of tools which helps to automate software development lifecycle including continuous integration and deployment. As any of the automated workflow, GitHub use two type of machines named as GitHub hosted runners which are hosted by GitHub and self-hosted runners which you can use your own machines to run GitHub actions. This blog explains how to setup a self-hosted runner in GitHub.
Why we need self-hosted runners?
- You can setup secured self-hosted agents when isolating your development environments to enhance the security by limiting the access from and to public internet.
- You can setup self-hosted agents when there are specific custom configurations required in runners
Let's get started.
Pre-requites:
Login to GitHub and open settings. Select Actions from the side menu and select the Runners section appeared in the side menu. You would be navigated to runners page. Click on New self-hosted runner to add a new self-hosted runner.
Select the runner image and architecture of the VM which going to configured as runner. Once you select the runner image, you can find the commands to configure runner.Login to VM which is going to be configured as runner. Open PowerShell window and run following commands to create directory, download GitHub action runner and extract it.
- Create a directory using following command and move to directory
mkdir actions-runner; cd actions-runner
- Download GitHub runner package
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.284.0/actions-runner-win-x64-2.284.0.zip -OutFile actions-runner-win-x64-2.284.0.zip
- Extract the installer
Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.284.0.zip", "$PWD")
No comments:
Post a Comment