forked from marcosfad/mbp-ubuntu-kernel
-
-
Notifications
You must be signed in to change notification settings - Fork 16
209 lines (189 loc) · 8.54 KB
/
kernel-update.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
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
206
207
208
209
---
name: Cron job to update kernel
on:
schedule:
- cron: '0 */8 * * *'
workflow_dispatch:
jobs:
Mainline:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Check for update
id: publish
run: |
latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
latestupstream=$(curl -sL https://kernel.org/ | grep "latest_button" -A 1 | awk "NR==2" | cut -d "/" -f 8 | cut -d "\"" -f 1 | cut -d "-" -f 2 | rev | cut -c 8- | rev)
echo "latestupstream is ${latestupstream}"
echo "current release is ${latestrelease}"
if [[ ${latestrelease} = ${latestupstream} ]]
then
echo "publish=no" >> $GITHUB_ENV
exit 0
else
echo "publish=yes" >> $GITHUB_ENV
sed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh
sed -i "s/PKGREL=.*/PKGREL=1/g" ${{ github.workspace }}/build.sh
echo "ver=${latestupstream}" >> $GITHUB_ENV
fi
- name: Update the repo
if: env.publish == 'yes'
id: clean
run: |
cd ${{ github.workspace }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Update kernel to v${{ env.ver }}" -a
- name: Push changes to the repo
if: env.publish == 'yes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT }}
branch: ${{ github.ref }}
LTS:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
with:
ref: LTS
persist-credentials: false
fetch-depth: 0
- name: Check for update
id: publish
run: |
LTS_VER=6.6
latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
latestupstream=$(curl -sL https://kernel.org/ | grep ${LTS_VER} | grep tar.xz | cut -d "/" -f 8 | cut -d "\"" -f 1 | cut -d "-" -f 2 | rev | cut -c 8- | rev)
echo "latestupstream is ${latestupstream}"
echo "current release is ${latestrelease}"
if [[ ${latestrelease} = ${latestupstream} ]]
then
echo "publish=no" >> $GITHUB_ENV
exit 0
else
echo "publish=yes" >> $GITHUB_ENV
sed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh
sed -i "s/PKGREL=.*/PKGREL=1/g" ${{ github.workspace }}/build.sh
echo "ver=${latestupstream}" >> $GITHUB_ENV
fi
- name: Update the repo
if: env.publish == 'yes'
id: clean
run: |
cd ${{ github.workspace }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Update kernel to v${{ env.ver }}" -a
- name: Push changes to the repo
if: env.publish == 'yes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT }}
branch: LTS
Mainline_Xanmod:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
with:
ref: Mainline-Xanmod
persist-credentials: false
fetch-depth: 0
- name: Check for update
id: publish
run: |
latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
if [[ $(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 1) ]]
then
echo "Rolling Release"
latestupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 1)
else
echo "Stable Mainline"
latestupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Stable Mainline" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 1)
fi
latestpkgrel=$(grep "PKGREL=\d*" build.sh | cut -d = -f2)
if [[ $(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 2) ]]
then
echo "Rolling Release"
latestpkgupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Rolling Release" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 2)
else
echo "Stable Mainline"
latestpkgupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Stable Mainline" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 2)
fi
echo "latestrelease: ${latestrelease}"
echo "latestupstream: ${latestupstream}"
echo "latestpkgrel: ${latestpkgrel}"
echo "latestpkgupstream: ${latestpkgupstream}"
if [[ ( ${latestrelease} = ${latestupstream} ) && ( ${latestpkgrel} = ${latestpkgupstream} ) ]]
then
echo "publish=no" >> $GITHUB_ENV
exit 0
else
echo "publish=yes" >> $GITHUB_ENV
sed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh
sed -i "s/PKGREL=.*/PKGREL=${latestpkgupstream}/g" ${{ github.workspace }}/build.sh
echo "ver=${latestupstream}-${latestpkgupstream}" >> $GITHUB_ENV
fi
- name: Update the repo
if: env.publish == 'yes'
id: clean
run: |
cd ${{ github.workspace }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Update kernel to v${{ env.ver }}" -a
- name: Push changes to the repo
if: env.publish == 'yes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT }}
branch: Mainline-Xanmod
LTS_Xanmod:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
with:
ref: LTS-Xanmod
persist-credentials: false
fetch-depth: 0
- name: Check for update
id: publish
run: |
latestrelease=$(grep ^KERNEL_VERSION build.sh | head -n1| cut -d = -f2)
latestupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Long Term Support" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 1)
latestpkgrel=$(grep "PKGREL=\d*" build.sh | cut -d = -f2)
latestpkgupstream=$(curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" -sL https://xanmod.org/ | grep -A2 "Long Term Support" | grep xanmod | cut -d '=' -f 8 | cut -d '-' -f 2)
echo "latestrelease: ${latestrelease}"
echo "latestupstream: ${latestupstream}"
echo "latestpkgrel: ${latestpkgrel}"
echo "latestpkgupstream: ${latestpkgupstream}"
if [[ ( ${latestrelease} = ${latestupstream} ) && ( ${latestpkgrel} = ${latestpkgupstream} ) ]]
then
echo "publish=no" >> $GITHUB_ENV
exit 0
else
echo "publish=yes" >> $GITHUB_ENV
sed -i "s/${latestrelease}/${latestupstream}/g" ${{ github.workspace }}/build.sh
sed -i "s/PKGREL=.*/PKGREL=${latestpkgupstream}/g" ${{ github.workspace }}/build.sh
echo "ver=${latestupstream}-${latestpkgupstream}" >> $GITHUB_ENV
fi
- name: Update the repo
if: env.publish == 'yes'
id: clean
run: |
cd ${{ github.workspace }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Update kernel to v${{ env.ver }}" -a
- name: Push changes to the repo
if: env.publish == 'yes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT }}
branch: LTS-Xanmod