Skip to content

Update kernel.yml

Update kernel.yml #595

Workflow file for this run

---
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@v4
- name: 'Set up Python 3.9'
uses: actions/setup-python@v5.1.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
Build-Jammy:
needs: [Lint]
runs-on: ubuntu-22.04
steps:
- name: Free up disk space for the CI
uses: AdityaGarg8/remove-unwanted-software@v3
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
- name: 'Checkout Repo'
uses: actions/checkout@v4
- 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
sudo ./build.sh
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@v4
with:
name: linux-T2-${{ steps.build.outputs.tag }}-jammy
path: /tmp/artifacts/*
- name: Release
if: github.ref == 'refs/heads/Mainline'
uses: softprops/action-gh-release@v2
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 }}
Build-Debian:
needs: [Lint]
runs-on: ubuntu-22.04
steps:
- name: Free up disk space for the CI
uses: AdityaGarg8/remove-unwanted-software@v3
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
- name: 'Checkout Repo'
uses: actions/checkout@v4
- 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=debian:12
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 && \
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@v4
with:
name: linux-T2-${{ steps.build.outputs.tag }}-mantic
path: /tmp/artifacts/*
- name: Release
if: github.ref == 'refs/heads/Mainline'
uses: softprops/action-gh-release@v2
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 }}
Build-Noble:
needs: [Lint]
runs-on: ubuntu-22.04
steps:
- name: Free up disk space for the CI
uses: AdityaGarg8/remove-unwanted-software@v3
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
- name: 'Checkout Repo'
uses: actions/checkout@v4
- 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=ubuntu:24.04
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 && \
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@v4
with:
name: linux-T2-${{ steps.build.outputs.tag }}-noble
path: /tmp/artifacts/*
- name: Release
if: github.ref == 'refs/heads/Mainline'
uses: softprops/action-gh-release@v2
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-Jammy, Build-Debian, Build-Noble]
runs-on: ubuntu-22.04
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
- 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 }}