forked from marcosfad/mbp-ubuntu-kernel
-
-
Notifications
You must be signed in to change notification settings - Fork 29
177 lines (164 loc) · 5.48 KB
/
kernel.yml
File metadata and controls
177 lines (164 loc) · 5.48 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
---
name: Build Kernel Package
# yamllint disable-line rule:truthy
on:
push:
paths-ignore:
- 'apt-repo/*.txt'
- '.github/workflows/apfs.yml'
- '.github/workflows/gmux.yml'
pull_request:
workflow_dispatch:
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repo'
uses: actions/checkout@v6
- name: 'Set up Python 3.9'
uses: actions/setup-python@v6.2.0
- name: 'Install dependencies'
run: |
python -m pip install --upgrade pip
pip install yamllint
sudo apt-get install shellcheck bash
- name: 'Analysing the code'
run: |
yamllint -c ${{ github.workspace }}/.github/workflows/.ymllint .
shellcheck ./*.sh
Create-tag:
needs: [Lint]
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v6
- name: Build script
id: build
run: |
mkdir /tmp/artifacts
VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
REL=$(grep "PKGREL=\d*" build.sh | cut -d = -f2)
#REL=$( git tag |grep -F $VERSION|sort -r|head -n1|tr -d v)
echo Building $VERSION-$REL
echo "tag=${VERSION}-${REL}" >> $GITHUB_OUTPUT
- name: Create tag
if: github.ref == 'refs/heads/Mainline'
uses: rickstaa/action-create-tag@v1
with:
tag: "v${{ steps.build.outputs.tag }}"
Build:
strategy:
matrix:
target:
- image: ubuntu
tag: "22.04"
name: jammy
- image: ubuntu
tag: "24.04"
name: noble
- image: ubuntu
tag: "25.10"
name: questing
- image: ubuntu
tag: "26.04"
name: resolute
- image: debian
tag: "12"
name: bookworm
- image: debian
tag: "trixie"
name: trixie
- image: debian
tag: testing
name: testing
needs: [Create-tag]
runs-on: ubuntu-latest
steps:
- name: Free up disk space for the CI
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
remove-large-packages: 'true'
remove-cached-tools: 'true'
remove-swapfile: 'true'
- name: 'Checkout Repo'
uses: actions/checkout@v6
- name: Build script
id: build
run: |
mkdir /tmp/artifacts
VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
REL=$(grep "PKGREL=\d*" build.sh | cut -d = -f2)
#REL=$( git tag |grep -F $VERSION|sort -r|head -n1|tr -d v)
echo Building $VERSION-$REL
echo "tag=${VERSION}-${REL}" >> $GITHUB_OUTPUT
DOCKER_IMAGE=${{ matrix.target.image }}:${{ matrix.target.tag }}
docker pull ${DOCKER_IMAGE}
docker run \
-t \
-v "$(pwd)":/repo \
${DOCKER_IMAGE} \
/bin/bash -c 'cd /repo && \
apt-get update && \
apt-get install -y lsb-release base-files && \
mkdir /tmp/artifacts && \
./build.sh && mkdir /repo/debs && \
cp -r /tmp/artifacts/* /repo/debs'
cp -r "$(pwd)"/debs/* /tmp/artifacts
cd /tmp/artifacts
#rm /tmp/artifacts/*dbg*
ls -l
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
ls -l
- name: Upload package artifact
uses: actions/upload-artifact@v7
with:
name: linux-T2-${{ steps.build.outputs.tag }}-${{ matrix.target.name }}
path: /tmp/artifacts/*
- name: Release
if: github.ref == 'refs/heads/Mainline'
uses: softprops/action-gh-release@v3
with:
files: |
/tmp/artifacts/sha256*
/tmp/artifacts/*.deb
/tmp/artifacts/kernel_config*
tag_name: v${{ steps.build.outputs.tag }}
body_path: ${{ github.workspace }}/.github/workflows/instructions.txt
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Publish:
needs: [Build]
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v6
- name: Update kernel in apt repo
if: github.ref == 'refs/heads/Mainline'
id: publish
run: |
VERSION=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
REL=$(grep "PKGREL=\d*" build.sh | cut -d = -f2)
echo "ver=${VERSION}-${REL}" >> $GITHUB_ENV
git clone https://github.com/AdityaGarg8/t2-ubuntu-repo.git
cd t2-ubuntu-repo
sed -i "s/VERSION=.*/VERSION=${VERSION}/g" ./.github/kernel/linux-t2
sed -i "s/REL=.*/REL=${REL}/g" ./.github/kernel/linux-t2
- name: Push changes to apt repo
if: github.ref == 'refs/heads/Mainline'
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: 't2-ubuntu-repo'
destination-github-username: 'AdityaGarg8'
destination-repository-name: 't2-ubuntu-repo'
user-email: github-actions[bot]@users.noreply.github.com
user-name: github-actions[bot]
target-branch: main
commit-message: Update kernel (Mainline) to v${{ env.ver }}