forked from marcosfad/mbp-ubuntu-kernel
-
-
Notifications
You must be signed in to change notification settings - Fork 17
92 lines (83 loc) · 3.09 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
---
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@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Get the latest driver
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)
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@v3
with:
ref: LTS
persist-credentials: false
fetch-depth: 0
- name: Get the latest driver
id: publish
run: |
LTS_VER=6.1
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)
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