-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (127 loc) · 4.47 KB
/
debian-runners.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build Debian Runners
run-name: Debian Runner Build (${{ github.event_name }})
on:
push:
branches:
- "main"
paths:
- "runner/**"
- "!runner/Makefile"
- "debian/**"
- ".github/workflows/debian-runners.yaml"
- "!**.md"
workflow_dispatch:
inputs:
force-push:
description: "push to GHCR"
type: boolean
required: true
default: false
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
env:
RUNNER_VERSION: 2.299.1
DOCKER_VERSION: 20.10.12
RUNNER_CONTAINER_HOOKS_VERSION: 0.1.2
jobs:
build-runners:
name: ${{ matrix.os-name }}-${{ matrix.os-version }} ${{ matrix.name }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
name: [actions-runner, actions-runner-dind]
os-name: [debian]
os-version: [11, 12]
include:
- os-version: 11
tag-latest: true
tag-os: true
- os-version: 12
tag-latest: false
tag-os: false
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Get short SHA ref
id: vars
run: |
echo "sha_short=${GITHUB_SHA::8}" >> $GITHUB_ENV
- name: Map debian version to name
id: version-map
run: |
case ${{ matrix.os-version }} in
11)
echo "os_version_name=bullseye" >> $GITHUB_ENV
;;
12)
echo "os_version_name=bookworm" >> $GITHUB_ENV
;;
*)
echo "Unable to map '${{ matrix.os-version }}' to a release name..."
exit 1
;;
esac
- name: Set build dockerfile
id: Copy
run: |
if [[ -d "${{ matrix.os-name }}" ]]; then
cp ${{ matrix.os-name }}/${{ matrix.name }}-${{ env.os_version_name }}.dockerfile \
./runner/${{ matrix.name }}-${{ matrix.os-name }}.dockerfile || exit 1
echo "Using custom dockerfile from ${{ matrix.os-name }}"
else
# Passthrough build, rename the upstream dockerfile
cp runner/${{ matrix.name }}.dockerfile runner/${{ matrix.name }}-${{ matrix.os-name }}.dockerfile || exit 1
echo "Doing passthrough build from upstream dockerfile"
fi
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/${{ matrix.name }}
tags: |
type=raw,value=latest,enable=${{ matrix.tag-latest }}
type=raw,value=${{ matrix.os-name }},enable=${{ matrix.tag-os }}
type=raw,value=${{ matrix.os-name }}-${{ matrix.os-version }}
type=raw,value=${{ matrix.os-name }}-${{ env.os_version_name }}
type=raw,value=v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}
type=raw,value=v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ env.sha_short }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Versioned Tags
uses: docker/build-push-action@v5
with:
context: ./runner
file: ./runner/${{ matrix.name }}-${{ matrix.os-name }}.dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || inputs.force-push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PARENT_IMAGE=${{ matrix.os-name }}:${{ env.os_version_name }}
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
DOCKER_VERSION=${{ env.DOCKER_VERSION }}
RUNNER_CONTAINER_HOOKS_VERSION=${{ env.RUNNER_CONTAINER_HOOKS_VERSION }}
cache-from: type=gha,scope=build-${{ matrix.name }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}