-
Notifications
You must be signed in to change notification settings - Fork 2
205 lines (182 loc) · 6.5 KB
/
build.yml
File metadata and controls
205 lines (182 loc) · 6.5 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2026 SUSE LLC
#
# Author: Daniel Wagner <dwagner@suse.de>
name: "Build"
on:
push:
branches:
- main
tags:
- '*.*'
permissions:
packages: write
contents: write
jobs:
# ------------------------
# Step 1: define the matrix
# ------------------------
distro_matrix:
runs-on: ubuntu-latest
outputs:
distros: ${{ steps.set_matrix.outputs.distros }}
steps:
- name: Set matrix of distros
id: set_matrix
run: |
echo 'distros=["debian","fedora","tumbleweed","alpine"]' >> $GITHUB_OUTPUT
# ------------------------
# Step 2: Build staging images
# ------------------------
build_staging:
runs-on: ubuntu-latest
needs:
- distro_matrix
strategy:
matrix:
distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }}
name: Build staging container
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Get release version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to ghcr.io
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build staging image
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
file: staging/Dockerfile.${{ matrix.distro }}
platforms: linux/amd64
push: true
provenance: false
tags: |
ghcr.io/linux-nvme/${{ matrix.distro }}.staging:next
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}.staging:main', matrix.distro) || '' }}
# ------------------------
# Step 3: Build tools using staging containers
# ------------------------
build_tools:
runs-on: ubuntu-latest
needs:
- distro_matrix
- build_staging
strategy:
matrix:
distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }}
name: Build samurai and muon
container:
image: ghcr.io/linux-nvme/${{ matrix.distro }}.staging:next
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Build tools
run: scripts/build-muon.sh
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: samu-muon-${{ matrix.distro }}
path: bin
# ------------------------
# Step 4: Deploy final containers
# ------------------------
deploy_containers:
runs-on: ubuntu-latest
needs:
- distro_matrix
- build_tools
strategy:
matrix:
distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }}
name: Deploy final containers
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Get release version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=" >> $GITHUB_ENV
fi
- name: Download artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8
with:
name: samu-muon-${{ matrix.distro }}
path: bin
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to ghcr.io
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build final image
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: .
file: main/Dockerfile.${{ matrix.distro }}
platforms: linux/amd64
push: true
provenance: false
tags: |
ghcr.io/linux-nvme/${{ matrix.distro }}:next
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}:{1}', matrix.distro, env.RELEASE_VERSION) || '' }}
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}:latest', matrix.distro) || '' }}
deploy_cross_containers:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- armhf
- ppc64le
- s390x
name: ubuntu cross container
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Get release version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Login to ghcr.io
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
file: main/Dockerfile.ubuntu.${{ matrix.arch }}
platforms: linux/amd64
push: true
provenance: false
tags: |
ghcr.io/linux-nvme/ubuntu-cross-${{ matrix.arch }}:next
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/ubuntu-cross-{0}:{1}', matrix.arch, env.RELEASE_VERSION) || '' }}
${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/ubuntu-cross-{0}:latest', matrix.arch) || '' }}