Added publish script for putting the images on docker hub

This commit is contained in:
janssen
2024-09-06 16:04:09 +02:00
parent 3f8f131f50
commit b05f4fb70e
5 changed files with 52 additions and 18 deletions

31
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Publish
on: [release]
jobs:
publish:
runs-on: windows-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: tiobesoftware/github-runner-windows:${{ github.ref }}
build-args: |
SERVERCORE_VERSION="ltsc2022"
RUNNER_VERSION="${{ github.ref }}"
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: tiobesoftware/github-runner-windows:${{ github.ref }}-20H2
build-args: |
SERVERCORE_VERSION="20H2"
RUNNER_VERSION="${{ github.ref }}"

View File

@@ -1,6 +1,7 @@
FROM mcr.microsoft.com/windows/servercore:ltsc2022
ARG SERVERCORE_VERSION="ltsc2022"
ARG RUNNER_VERSION="2.319.1"
ARG RUNNER_VERSION="2.311.0"
FROM mcr.microsoft.com/windows/servercore:${SERVERCORE_VERSION}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
@@ -15,6 +16,7 @@ RUN choco install -y \
git \
gh \
powershell-core \
docker-cli \
python
RUN choco install -y visualstudio2022buildtools --package-parameters \" \

View File

@@ -4,10 +4,12 @@ This repository is a Windows version of the [myoung34/docker-github-actions-runn
This repository will run the [self-hosted github actions runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/hosting-your-own-runners) for Windows with [Visual Studio 2022 buildtools](https://community.chocolatey.org/packages/visualstudio2022buildtools) installed by default.
The build images can be found on [Docker Hub](https://hub.docker.com/r/tiobesoftware/github-runner-windows).
## Environment variables
| Environment Variable | Description |
| -------------------- | ----------- |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RUNNER_NAME` | The name of the runner to use. Overrides `RUNNER_NAME_PREFIX` |
| `RUNNER_NAME_PREFIX` | A prefix for runner name. Note: will be overridden by `RUNNER_NAME` if provided. Defaults to `windows-runner` |
| `ACCESS_TOKEN` | A [github PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) to use to generate `RUNNER_TOKEN` dynamically at container start. Not using this requires a valid `RUNNER_TOKEN` |

View File

@@ -88,7 +88,7 @@ if ($null -ne $TOKEN_URL) {
$RUNNER_TOKEN = ((Invoke-WebRequest -Uri $TOKEN_URL -Method "POST" -Headers $HEADERS).Content | ConvertFrom-Json).token
}
catch {
Write-Error "Cannot obtain the token => $_.Exception.Message"
Write-Error "Cannot obtain the token => $_"
exit
}
}

View File

@@ -1,3 +1,2 @@
# (New-Object System.Net.WebClient).DownloadFile("https://github.com/actions/runner/releases/download/v$env:RUNNER_VERSION/actions-runner-win-x64-$env:RUNNER_VERSION.zip","actions-runner.zip")
Invoke-WebRequest -Uri "https://github.com/actions/runner/releases/download/v$env:RUNNER_VERSION/actions-runner-win-x64-$env:RUNNER_VERSION.zip" -OutFile "actions-runner.zip"
Expand-Archive -Path ".\\actions-runner.zip" -DestinationPath '.'