-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (55 loc) · 1.92 KB
/
kernels.yml
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
# This job builds test kernels and uploads them to the `assets` dummy release.
#
# It works by looking at the KERNELS file in the repository and checks it
# against all the already-uploaded kernels.
name: Kernels
on:
workflow_dispatch: # Manual trigger
push: # Automatic trigger
branches: [ "master" ]
concurrency:
# Ensure only a single instance of this job is run at any time
group: ${{ github.ref }}
permissions:
contents: write
jobs:
build-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate needed kernels
id: calculate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
existing=$(gh release view assets --json assets --jq '.[][].name')
# Begin multiline output parameter
echo "NEEDED_KERNELS<<MULTILINE_EOF" >> "$GITHUB_OUTPUT"
echo "$existing" | python3 -c '
import sys
# Calculate kernels that have already been uploaded
existing = {line.strip() for line in sys.stdin}
with open("./KERNELS", "r") as f:
lines = {line.strip() for line in f if line.strip()}
# Print to stdout kernel we need to build and upload
for line in lines:
version = line.strip()
name = f"linux-{version}.tar.zst"
if name not in existing:
print(line)
' | tee -a "$GITHUB_OUTPUT"
# End multiline output parameter
echo "MULTILINE_EOF" >> "$GITHUB_OUTPUT"
- name: Build needed kernels
run: |
while IFS= read -r version; do
echo "Building: ${version}"
./build.sh "$version"
done <<< "${{ steps.calculate.outputs.NEEDED_KERNELS }}"
- name: Upload freshly built kernels
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for kernel in linux-*; do
gh release upload assets "$kernel"
done