-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (108 loc) · 3.36 KB
/
sbci-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
name: Build sbCI Runners
run-name: sbCI Runner Build (${{ github.event_name }})
on:
push:
paths:
- "sbci/*.dockerfile"
- ".github/workflows/sbci-runners.yaml"
- "!**.md"
workflow_run:
branches: ["main"]
types: [completed]
workflows:
- "Build Debian Runners"
workflow_dispatch:
inputs:
force-push:
description: "push to GHCR"
type: boolean
required: true
default: false
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
is_autobuild: ${{ endsWith(github.ref, 'heads/main') && contains(fromJson('["push", "workflow_run"]'), github.event_name)}}
jobs:
build:
name: ${{ matrix.name }} ${{ matrix.os-name }}-${{ matrix.os-version }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
name: [sbci-runner]
os-name: [debian]
os-version: [11, 12]
include:
- os-version: 11
tag-latest: false
tag-os: false
- os-version: 12
tag-latest: true
tag-os: true
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 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=${{ matrix.os-name }}-${{ env.os_version_name }}-${{ 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: ./sbci
file: ./sbci/${{ matrix.name }}.dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ env.is_autobuild || inputs.force-push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=build-${{ matrix.name }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.name }}