122 lines
4.8 KiB
YAML
122 lines
4.8 KiB
YAML
name: Runners
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
branches:
|
|
- 'master'
|
|
paths:
|
|
- 'runner/**'
|
|
- '!runner/Makefile'
|
|
- '.github/workflows/runners.yaml'
|
|
- '!**.md'
|
|
# We must do a trigger on a push: instead of a types: closed so GitHub Secrets
|
|
# are available to the workflow run
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
paths:
|
|
- 'runner/**'
|
|
- '!runner/Makefile'
|
|
- '.github/workflows/runners.yaml'
|
|
- '!**.md'
|
|
|
|
env:
|
|
RUNNER_VERSION: 2.299.1
|
|
DOCKER_VERSION: 20.10.21
|
|
RUNNER_CONTAINER_HOOKS_VERSION: 0.1.3
|
|
DOCKERHUB_USERNAME: summerwind
|
|
|
|
jobs:
|
|
build-runners:
|
|
name: Build ${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: actions-runner
|
|
os-name: ubuntu
|
|
os-version: 20.04
|
|
latest: "true"
|
|
- name: actions-runner
|
|
os-name: ubuntu
|
|
os-version: 22.04
|
|
latest: "false"
|
|
- name: actions-runner-dind
|
|
os-name: ubuntu
|
|
os-version: 20.04
|
|
latest: "true"
|
|
- name: actions-runner-dind
|
|
os-name: ubuntu
|
|
os-version: 22.04
|
|
latest: "false"
|
|
- name: actions-runner-dind-rootless
|
|
os-name: ubuntu
|
|
os-version: 20.04
|
|
latest: "true"
|
|
- name: actions-runner-dind-rootless
|
|
os-name: ubuntu
|
|
os-version: 22.04
|
|
latest: "false"
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Docker Environment
|
|
uses: ./.github/actions/setup-docker-environment
|
|
with:
|
|
username: ${{ env.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
|
ghcr_username: ${{ github.actor }}
|
|
ghcr_password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and Push Versioned Tags
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: ./runner
|
|
file: ./runner/${{ matrix.name }}.${{ matrix.os-name }}-${{ matrix.os-version }}.dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
|
build-args: |
|
|
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
|
|
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
|
|
RUNNER_CONTAINER_HOOKS_VERSION=${{ env.RUNNER_CONTAINER_HOOKS_VERSION }}
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.sha_short }}
|
|
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
ghcr.io/${{ github.repository }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
ghcr.io/${{ github.repository }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.sha_short }}
|
|
ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
cache-from: type=gha,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
|
|
# NOTE : Only to be used on the 20.04 image until we remove the latest tag entirely
|
|
# at which point this step needs to be deleted
|
|
# https://github.com/actions/actions-runner-controller/issues/2056
|
|
- name: Build and Push Latest Tags
|
|
if: ${{ matrix.latest == 'true' }}
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: ./runner
|
|
file: ./runner/${{ matrix.name }}.${{ matrix.os-name }}-${{ matrix.os-version }}.dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
|
build-args: |
|
|
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
|
|
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
|
|
RUNNER_CONTAINER_HOOKS_VERSION=${{ env.RUNNER_CONTAINER_HOOKS_VERSION }}
|
|
tags: |
|
|
${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest
|
|
ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest
|
|
cache-from: type=gha,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|
|
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}-${{ matrix.os-name }}-${{ matrix.os-version }}
|