mirror of
https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel.git
synced 2026-08-16 05:22:19 -07:00
169 lines
5.2 KiB
YAML
169 lines
5.2 KiB
YAML
---
|
|
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@v7
|
|
- name: 'Set up Python 3.9'
|
|
uses: actions/setup-python@v7.0.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@v7
|
|
|
|
- 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/LTS'
|
|
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: "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'
|
|
|
|
- name: 'Checkout Repo'
|
|
uses: actions/checkout@v7
|
|
|
|
- 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/LTS'
|
|
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@v7
|
|
|
|
- name: Update kernel in apt repo
|
|
if: github.ref == 'refs/heads/LTS'
|
|
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-lts
|
|
sed -i "s/REL=.*/REL=${REL}/g" ./.github/kernel/linux-t2-lts
|
|
- name: Push changes to apt repo
|
|
if: github.ref == 'refs/heads/LTS'
|
|
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 (LTS) to v${{ env.ver }}
|