|
@@ -1,221 +1,120 @@
|
|
|
-on:
|
|
|
- push:
|
|
|
- tags:
|
|
|
- - 'debian-*'
|
|
|
-
|
|
|
name: Debian
|
|
|
|
|
|
env:
|
|
|
GPG_KEY_ID: 56C464BAAC421453
|
|
|
- KERNEL_VERSION: 6.4.4
|
|
|
- KERNEL_REVISION: 3
|
|
|
- LOCALVERSION: -surface
|
|
|
- MAINLINE_REPO: git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack
|
|
|
- MAINLINE_BRANCH: cod/mainline
|
|
|
- TZ: UTC
|
|
|
+
|
|
|
+on:
|
|
|
+ push:
|
|
|
+ tags:
|
|
|
+ - 'debian-*'
|
|
|
|
|
|
jobs:
|
|
|
build:
|
|
|
name: Build Kernel
|
|
|
runs-on: ubuntu-latest
|
|
|
- container: ubuntu:20.04
|
|
|
steps:
|
|
|
- - name: Checkout code
|
|
|
- uses: actions/checkout@v3
|
|
|
-
|
|
|
- - name: Install build dependencies
|
|
|
- run: |
|
|
|
- sed 's/^deb /deb-src /' /etc/apt/sources.list >> /etc/apt/sources.list
|
|
|
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
|
|
|
- echo $TZ > /etc/timezone
|
|
|
- apt-get -y update
|
|
|
- apt-get -y upgrade
|
|
|
- apt-get -y install build-essential fakeroot rsync git wget software-properties-common \
|
|
|
- zstd lz4 sbsigntool debhelper dpkg-dev dpkg-sig
|
|
|
- apt-get -y build-dep linux
|
|
|
-
|
|
|
- - name: Install Python 3.11
|
|
|
- run: |
|
|
|
- # install python 3.11, required for configuring the kernel via Ubuntu's annotation format
|
|
|
- add-apt-repository -y ppa:deadsnakes
|
|
|
-
|
|
|
- apt-get -y update
|
|
|
- apt-get -y upgrade
|
|
|
-
|
|
|
- apt-get -y install python3.11
|
|
|
-
|
|
|
- rm -f /usr/bin/python
|
|
|
- rm -f /usr/bin/python3
|
|
|
- ln -s /usr/bin/python3.11 /usr/bin/python
|
|
|
- ln -s /usr/bin/python3.11 /usr/bin/python3
|
|
|
-
|
|
|
- - name: Prepare kernel source
|
|
|
- run: |
|
|
|
- cd pkg/debian/kernel
|
|
|
-
|
|
|
- # setup git
|
|
|
- git config --global user.email "surfacebot@users.noreply.github.com"
|
|
|
- git config --global user.name "surfacebot"
|
|
|
-
|
|
|
- # get ubuntu mainline source
|
|
|
- # see https://kernel.ubuntu.com/~kernel-ppa/mainline
|
|
|
- git clone "$MAINLINE_REPO" --branch "$MAINLINE_BRANCH/v$KERNEL_VERSION" --depth 1 linux
|
|
|
-
|
|
|
- cd linux
|
|
|
-
|
|
|
- # apply surface build/packaging patches
|
|
|
- for PATCH in ../*.patch; do
|
|
|
- git apply --index --reject ${PATCH}
|
|
|
- done
|
|
|
-
|
|
|
- git add .
|
|
|
- git commit --allow-empty -m "Apply linux-surface packaging patches"
|
|
|
-
|
|
|
- # apply surface patches
|
|
|
- for PATCH in ../../../../patches/${KERNEL_VERSION%.*}/*.patch; do
|
|
|
- git apply --index --reject ${PATCH}
|
|
|
- done
|
|
|
-
|
|
|
- git add .
|
|
|
- git commit --allow-empty -m "Apply linux-surface patches"
|
|
|
-
|
|
|
- - name: Configure
|
|
|
- run: |
|
|
|
- cd pkg/debian/kernel/linux
|
|
|
-
|
|
|
- # generate base config
|
|
|
- ./debian/scripts/misc/annotations --arch amd64 --flavour generic --export > ../base.config
|
|
|
-
|
|
|
- # merge configs
|
|
|
- ./scripts/kconfig/merge_config.sh \
|
|
|
- ../base.config \
|
|
|
- ../ubuntu.config \
|
|
|
- ../../../../configs/surface-${KERNEL_VERSION%.*}.config
|
|
|
-
|
|
|
- - name: Setup secureboot certificate
|
|
|
- env:
|
|
|
- SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
|
|
|
- run: |
|
|
|
- cd pkg
|
|
|
-
|
|
|
- mkdir -p debian/kernel/linux/keys
|
|
|
-
|
|
|
- # unlock/copy key and certificate
|
|
|
- echo "$SB_KEY" | base64 -d > debian/kernel/linux/keys/MOK.key
|
|
|
- cp keys/surface.crt debian/kernel/linux/keys/MOK.crt
|
|
|
-
|
|
|
- - name: Build kernel
|
|
|
- env:
|
|
|
- # The DPKG in Ubuntu 22.04 defaults to using ZSTD,
|
|
|
- # which is not yet supported by the DPKG in Debian 11
|
|
|
- KDEB_COMPRESS: xz
|
|
|
- run: |
|
|
|
- cd pkg/debian/kernel/linux
|
|
|
-
|
|
|
- # Explicitly set package version, including revision. This is picked up
|
|
|
- # by 'make bindeb-pkg'.
|
|
|
- export KDEB_PKGVERSION="${KERNEL_VERSION}${LOCALVERSION}-${KERNEL_REVISION}"
|
|
|
-
|
|
|
- make bindeb-pkg -j2
|
|
|
-
|
|
|
- - name: Build meta-package
|
|
|
- run: |
|
|
|
- cd pkg/debian/meta
|
|
|
- ./mkdebian.sh $(make -C ../kernel/linux -s kernelrelease) ${KERNEL_REVISION}
|
|
|
- dpkg-buildpackage -b -Zxz
|
|
|
-
|
|
|
- - name: Prepare release
|
|
|
- run: |
|
|
|
- mkdir release
|
|
|
- rm pkg/debian/kernel/linux-libc-dev*.deb
|
|
|
- mv pkg/debian/kernel/*.deb release
|
|
|
- mv pkg/debian/*.deb release
|
|
|
-
|
|
|
- - name: Sign packages
|
|
|
- env:
|
|
|
- GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
|
|
|
- run: |
|
|
|
- # import GPG key
|
|
|
- echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
|
|
|
- export GPG_TTY=$(tty)
|
|
|
-
|
|
|
- # sign package
|
|
|
- dpkg-sig -g "--batch --no-tty" --sign builder -k $GPG_KEY_ID release/*.deb
|
|
|
-
|
|
|
- - name: Upload artifacts
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
- with:
|
|
|
- name: debian-latest
|
|
|
- path: release
|
|
|
+ - name: Maximize disk space
|
|
|
+ uses: easimon/maximize-build-space@master
|
|
|
+ with:
|
|
|
+ root-reserve-mb: 5120
|
|
|
+ remove-dotnet: true
|
|
|
+ remove-android: true
|
|
|
+ remove-docker-images: true
|
|
|
+
|
|
|
+ - name: Checkout code
|
|
|
+ uses: actions/checkout@v3
|
|
|
+
|
|
|
+ - name: Initialize containers
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/create.sh \
|
|
|
+ ubuntu:20.04
|
|
|
+
|
|
|
+ - name: Install build dependencies
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/exec.sh \
|
|
|
+ -- \
|
|
|
+ bash ./.github/scripts/package/debian.sh setup-builddeps
|
|
|
+
|
|
|
+ - name: Setup secureboot certificate
|
|
|
+ env:
|
|
|
+ SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/exec.sh \
|
|
|
+ -e SB_KEY \
|
|
|
+ -- \
|
|
|
+ bash ./.github/scripts/package/debian.sh setup-secureboot
|
|
|
+
|
|
|
+ - name: Build packages
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/exec.sh \
|
|
|
+ -- \
|
|
|
+ bash ./.github/scripts/package/debian.sh build-packages
|
|
|
+
|
|
|
+ - name: Sign packages
|
|
|
+ env:
|
|
|
+ GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/exec.sh \
|
|
|
+ -e GPG_KEY \
|
|
|
+ -e GPG_KEY_ID \
|
|
|
+ -- \
|
|
|
+ bash ./.github/scripts/package/debian.sh sign-packages
|
|
|
+
|
|
|
+ - name: Upload artifacts
|
|
|
+ uses: actions/upload-artifact@v3
|
|
|
+ with:
|
|
|
+ name: debian-latest
|
|
|
+ path: pkg/debian/release
|
|
|
|
|
|
release:
|
|
|
name: Publish release
|
|
|
needs: [build]
|
|
|
runs-on: ubuntu-latest
|
|
|
steps:
|
|
|
- - name: Download artifacts
|
|
|
- uses: actions/download-artifact@v3
|
|
|
- with:
|
|
|
- name: debian-latest
|
|
|
- path: debian-latest
|
|
|
-
|
|
|
- - name: Upload assets
|
|
|
- uses: svenstaro/upload-release-action@v2
|
|
|
- with:
|
|
|
- repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
|
|
|
- file: ./*-latest/*
|
|
|
- tag: ${{ github.ref }}
|
|
|
- overwrite: true
|
|
|
- file_glob: true
|
|
|
+ - name: Download artifacts
|
|
|
+ uses: actions/download-artifact@v3
|
|
|
+ with:
|
|
|
+ name: debian-latest
|
|
|
+ path: debian-latest
|
|
|
+
|
|
|
+ - name: Upload assets
|
|
|
+ uses: svenstaro/upload-release-action@v2
|
|
|
+ with:
|
|
|
+ repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
|
|
|
+ file: ./*-latest/*
|
|
|
+ tag: ${{ github.ref }}
|
|
|
+ overwrite: true
|
|
|
+ file_glob: true
|
|
|
|
|
|
repo:
|
|
|
name: Update package repository
|
|
|
needs: [release]
|
|
|
runs-on: ubuntu-latest
|
|
|
- container: debian:sid
|
|
|
steps:
|
|
|
- - name: Install dependencies
|
|
|
- run: |
|
|
|
- apt-get update
|
|
|
- apt-get install -y git
|
|
|
-
|
|
|
- - name: Download artifacts
|
|
|
- uses: actions/download-artifact@v3
|
|
|
- with:
|
|
|
- name: debian-latest
|
|
|
- path: debian-latest
|
|
|
-
|
|
|
- - name: Update repository
|
|
|
- env:
|
|
|
- SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
|
|
|
- BRANCH_STAGING: u/staging
|
|
|
- GIT_REF: ${{ github.ref }}
|
|
|
- run: |
|
|
|
- repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
|
|
|
-
|
|
|
- # clone package repository
|
|
|
- git clone -b "${BRANCH_STAGING}" "${repo}" repo
|
|
|
-
|
|
|
- # copy packages
|
|
|
- cp debian-latest/* repo/debian/
|
|
|
- cd repo/debian
|
|
|
-
|
|
|
- # parse git tag from ref
|
|
|
- GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
|
|
|
-
|
|
|
- # convert packages into references
|
|
|
- for pkg in $(find . -name '*.deb'); do
|
|
|
- echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
|
|
|
- rm $pkg
|
|
|
- done
|
|
|
-
|
|
|
- # set git identity
|
|
|
- git config --global user.email "surfacebot@users.noreply.github.com"
|
|
|
- git config --global user.name "surfacebot"
|
|
|
-
|
|
|
- # commit and push
|
|
|
- update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
|
|
- git switch -c "${update_branch}"
|
|
|
- git add .
|
|
|
- git commit -m "Update Debian kernel"
|
|
|
- git push --set-upstream origin "${update_branch}"
|
|
|
+ - name: Checkout repository
|
|
|
+ uses: actions/checkout@v3
|
|
|
+
|
|
|
+ - name: Download artifacts
|
|
|
+ uses: actions/download-artifact@v3
|
|
|
+ with:
|
|
|
+ name: debian-latest
|
|
|
+ path: debian-latest
|
|
|
+
|
|
|
+ - name: Initialize containers
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/create.sh \
|
|
|
+ debian:sid
|
|
|
+
|
|
|
+ - name: Update repository
|
|
|
+ env:
|
|
|
+ SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
|
|
|
+ GIT_REF: ${{ github.ref }}
|
|
|
+ BRANCH_STAGING: u/staging
|
|
|
+ run: |
|
|
|
+ bash ./.github/scripts/container/exec.sh \
|
|
|
+ -e SURFACEBOT_TOKEN \
|
|
|
+ -e GIT_REF \
|
|
|
+ -e BRANCH_STAGING \
|
|
|
+ -e GITHUB_REPOSITORY \
|
|
|
+ -- \
|
|
|
+ bash ./.github/scripts/repository/debian.sh
|