-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (100 loc) · 3.44 KB
/
Copy pathrelease.yaml
File metadata and controls
106 lines (100 loc) · 3.44 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
name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
packages: write
jobs:
prepare:
name: Prepare
runs-on: ubuntu-20.04
outputs:
kernel_versions: ${{ steps.kernel_versions.outputs.value }}
target_arches: ${{ steps.target_arches.outputs.value }}
version_tag: ${{ steps.version_tag.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Format version tag
shell: bash
id: version_tag
run: |
TAG=${GITHUB_REF#refs/*/}
echo "value=$TAG" >> $GITHUB_OUTPUT
- name: Build Kernel Versions
id: kernel_versions
run: |
echo "value=$(cat KERNEL_VERSIONS | jq -ncR '[inputs | select(length>0)]')" >> $GITHUB_OUTPUT
- name: Build Target Archs
id: target_arches
run: |
echo "value=$(cat TARGET_ARCHES | jq -ncR '[inputs | select(length>0)]')" >> $GITHUB_OUTPUT
build:
name: Build
runs-on: ubuntu-20.04
needs: prepare
strategy:
matrix:
version: ${{ fromJson(needs.prepare.outputs.kernel_versions) }}
arch: ${{ fromJson(needs.prepare.outputs.target_arches) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: "Build Kernel Version: ${{ matrix.version }} Target Arch: ${{ matrix.arch }}"
shell: bash
run: |
docker build --build-arg KERNEL_VERSION=${{ matrix.version }} \
--build-arg ARCH="${{ matrix.arch }}" \
--build-arg CROSS_COMPILE="${{ matrix.arch == 'arm64' && 'aarch64-linux-gnu-' || '' }}" \
-t linux-headers:${{ matrix.arch }}-${{ matrix.version }} .
docker run --rm -v ${{ github.workspace }}/builds:/output linux-headers:${{ matrix.arch }}-${{ matrix.version }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/builds/linux-headers-${{ matrix.arch }}-${{ matrix.version }}.tar.gz
release:
name: Release
runs-on: ubuntu-20.04
needs:
- build
- prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v3
with:
path: ${{ github.workspace }}
- name: Group by Arch and Compress
shell: bash
working-directory: ${{ github.workspace }}/artifact
run: |
ROOT_REPO=$(git rev-parse --show-toplevel)
TARGET_ARCHES=($(cat $ROOT_REPO/TARGET_ARCHES))
for arch in "${TARGET_ARCHES[@]}"; do
tar -cvzf linux-headers-${arch}.tar.gz linux-headers-${arch}-*.tar.gz
mv linux-headers-${arch}.tar.gz $ROOT_REPO
done
- name: Build Release Body
shell: bash
run: |
kernel_versions=($(cat KERNEL_VERSIONS))
md="## Support Kernel Version\n"
for version in "${kernel_versions[@]}"; do
md+="* $version\n"
done
target_arches=($(cat TARGET_ARCHES))
md+="\n## Support Arch\n"
for version in "${target_arches[@]}"; do
md+="* $version\n"
done
echo -ne "$md" > ${{ github.workspace }}/body.md
- uses: ncipollo/release-action@v1
with:
artifacts: "*.tar.gz"
bodyFile: ${{ github.workspace }}/body.md
tag: ${{ needs.prepare.outputs.version_tag }}