Skip to content

Cron job to update kernel #2187

Cron job to update kernel

Cron job to update kernel #2187

Workflow file for this run

---
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 9 | 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 9 | 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 9 | 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 9 | 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 9 | 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 9 | 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 9 | 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 9 | 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