Since the release of GitHub, Actions Microsoft has made Windows Server runners available to run workflows with PowerShell available.
This post will show how to use Windows Server 2016, 2019 and the latest release with GitHub Actions.
To run workflows on Windows runners, we need to specify in the workflow that we need to run the workflow on a Windows machine.
Currently, GitHub Actions offer the following Windows runner:
|windows-2016||Windows Server 2016|
|windows-2019||Windows Server 2019|
|Windows-latest||Latest Windows server release|
In the following workflow example, I am using a Windows Server 2019 build to run a workflow that runs PowerShell commands.
Note: All Windows Server runners run PowerShell 7.1.3
The below code run a few PowerShell command, and a Docker run commands the pull a Windows IIS image and runs it inside the runner.
name: How to use a Windows Runner on GitHub Actions on: push jobs: build: runs-on: windows-2019 steps: - name: Check out repo uses: actions/[email protected] - run: | $psversiontable write-host "Hello World" get-computerinfo docker run --name myiisserver -d mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019