In this lab you will create and use your self-hosted runners.
Duration: 10-15 minutes
References:
Prerequisites: Access to a Cloud platform to create a runner machine
- If you have access to an Azure subscription, follow the guide to create a Linux virtual machine
- Create a new private repository
my-private-repo
- Follow the guide to install the agent on the runner
- Follow the guide to use the self-hosted runner in a workflow
- Create a new workflow
.github/workflows/self-hosted-runners.yml
in your private repository and run the workflow on the self-hosted runner
name: Self-Hosted Runners Hello
on:
workflow_dispatch:
inputs:
name:
description: 'What is your name?'
required: true
default: 'World'
jobs:
say_hello_linux:
name: Say Hello from Linux Self-Hosted Runner
runs-on: [self-hosted, linux, x64, self-hosted-linux]
steps:
- name: Say hello from self-hosted linux runner
run: |
echo "Hello ${{ github.event.inputs.name }}, from self-hosted linux runner!"
say_hello_windows:
name: Say Hello from Windows Self-Hosted Runner
runs-on: [self-hosted, windows, x64, self-hosted-windows]
needs: say_hello_linux
steps:
- name: Say hello from self-hosted windows runner
run: |
echo "Hello ${{ github.event.inputs.name }}, from self-hosted windows runner!"
- Clean up your runner resources if not needed