2020-01-30 10:49:50 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'debian_lts-*'
|
|
|
|
|
|
|
|
name: Debian LTS
|
|
|
|
|
|
|
|
env:
|
|
|
|
GPG_KEY_ID: 56C464BAAC421453
|
2020-05-16 09:30:44 +00:00
|
|
|
KERNEL_VERSION: 4.19.123
|
|
|
|
KDEB_PKGVERSION: 4.19.123-1
|
2020-01-30 10:49:50 +00:00
|
|
|
LOCALVERSION: -surface-lts
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build Kernel
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: debian:sid
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install build dependencies
|
|
|
|
run: |
|
|
|
|
sed 's/^deb /deb-src /' /etc/apt/sources.list >> /etc/apt/sources.list
|
|
|
|
apt-get -y update
|
|
|
|
apt-get -y install build-essential fakeroot rsync git wget python3-debian dpkg-sig lz4 sbsigntool
|
|
|
|
apt-get -y build-dep linux
|
|
|
|
|
|
|
|
- name: Prepare kernel source
|
|
|
|
run: |
|
2020-04-02 23:21:12 +00:00
|
|
|
cd pkg/debian/kernel-lts
|
2020-01-30 10:49:50 +00:00
|
|
|
|
|
|
|
# get ubuntu build patches (for config)
|
|
|
|
SOURCE_URL="https://kernel.ubuntu.com/~kernel-ppa/mainline/v$KERNEL_VERSION"
|
|
|
|
SOURCE_LIST="$SOURCE_URL/SOURCES"
|
|
|
|
|
|
|
|
mkdir -p "ubuntu"
|
|
|
|
wget "$SOURCE_LIST" -O "ubuntu/SOURCES"
|
|
|
|
SOURCE_FILES="$(tail -n +2 "ubuntu/SOURCES")"
|
|
|
|
|
|
|
|
for f in $SOURCE_FILES; do
|
|
|
|
wget "$SOURCE_URL/$f" -O "ubuntu/$f"
|
|
|
|
done
|
|
|
|
|
|
|
|
# download kernel sources
|
|
|
|
wget https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/linux-$KERNEL_VERSION.tar.xz
|
|
|
|
tar xf linux-$KERNEL_VERSION.tar.xz
|
|
|
|
|
|
|
|
mv linux-$KERNEL_VERSION linux && cd linux
|
|
|
|
|
|
|
|
# apply ubuntu build patches
|
|
|
|
for PATCH in ../ubuntu/*.patch; do
|
|
|
|
patch -p1 < ${PATCH}
|
|
|
|
done
|
|
|
|
|
|
|
|
# apply surface build patches
|
|
|
|
for PATCH in ../*.patch; do
|
|
|
|
patch -p1 < ${PATCH}
|
|
|
|
done
|
|
|
|
|
|
|
|
# apply surface patches
|
2020-04-02 23:21:12 +00:00
|
|
|
for PATCH in ../../../../patches/${KERNEL_VERSION%.*}/*.patch; do
|
2020-01-30 10:49:50 +00:00
|
|
|
patch -p1 < ${PATCH}
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Configure
|
|
|
|
run: |
|
2020-04-02 23:21:12 +00:00
|
|
|
cd pkg/debian/kernel-lts/linux
|
2020-01-30 10:49:50 +00:00
|
|
|
|
|
|
|
# merge configs
|
|
|
|
./scripts/kconfig/merge_config.sh \
|
|
|
|
debian.master/config/config.common.ubuntu \
|
|
|
|
debian.master/config/amd64/config.common.amd64 \
|
|
|
|
debian.master/config/amd64/config.flavour.generic \
|
|
|
|
../ubuntu.config \
|
2020-04-02 23:21:12 +00:00
|
|
|
../../../../configs/surface-${KERNEL_VERSION%.*}.config
|
2020-01-30 10:49:50 +00:00
|
|
|
|
|
|
|
- name: Setup secureboot certificate
|
|
|
|
env:
|
|
|
|
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
|
|
|
|
run: |
|
|
|
|
cd pkg
|
|
|
|
|
2020-04-02 23:21:12 +00:00
|
|
|
mkdir -p debian/kernel-lts/linux/keys
|
2020-01-30 10:49:50 +00:00
|
|
|
|
|
|
|
# unlock/copy key and certificate
|
2020-04-02 23:21:12 +00:00
|
|
|
echo "$SB_KEY" | base64 -d > debian/kernel-lts/linux/keys/MOK.key
|
|
|
|
cp keys/surface.crt debian/kernel-lts/linux/keys/MOK.crt
|
2020-01-30 10:49:50 +00:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
2020-04-02 23:21:12 +00:00
|
|
|
cd pkg/debian/kernel-lts/linux
|
2020-01-30 10:49:50 +00:00
|
|
|
make bindeb-pkg -j2
|
|
|
|
|
|
|
|
- name: Prepare release
|
|
|
|
run: |
|
|
|
|
mkdir release
|
2020-04-02 23:21:12 +00:00
|
|
|
mv pkg/debian/kernel-lts/*.deb release
|
2020-01-30 10:49:50 +00:00
|
|
|
|
|
|
|
- name: Sign packages
|
|
|
|
env:
|
|
|
|
GPG_KEY: ${{ secrets.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@v1
|
|
|
|
with:
|
|
|
|
name: debian-latest
|
|
|
|
path: release
|
|
|
|
|
2020-02-18 17:57:02 +00:00
|
|
|
release:
|
|
|
|
name: Publish release
|
|
|
|
needs: [build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: debian-latest
|
|
|
|
|
|
|
|
- name: Upload assets
|
|
|
|
uses: svenstaro/upload-release-action@v1-release
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_BOT_TOKEN }}
|
|
|
|
file: ./*-latest/*
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
file_glob: true
|
|
|
|
|
2020-01-30 10:49:50 +00:00
|
|
|
repo:
|
|
|
|
name: Update package repository
|
2020-02-18 17:57:02 +00:00
|
|
|
needs: [release]
|
2020-01-30 10:49:50 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: debian:sid
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y reprepro git
|
|
|
|
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: debian-latest
|
|
|
|
|
|
|
|
- name: Update repository
|
|
|
|
env:
|
2020-02-18 17:46:03 +00:00
|
|
|
SURFACEBOT_TOKEN: ${{ secrets.GITHUB_BOT_TOKEN }}
|
|
|
|
BRANCH_STAGING: u/staging
|
2020-01-30 10:49:50 +00:00
|
|
|
GIT_REF: ${{ github.ref }}
|
|
|
|
run: |
|
2020-02-18 17:46:03 +00:00
|
|
|
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
|
2020-01-30 10:49:50 +00:00
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# clone package repository
|
|
|
|
git clone -b "${BRANCH_STAGING}" "${repo}" repo
|
2020-01-30 10:49:50 +00:00
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# copy packages
|
|
|
|
cp debian-latest/* repo/debian/
|
|
|
|
cd repo/debian
|
2020-01-30 10:49:50 +00:00
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# parse git tag from ref
|
2020-01-30 10:49:50 +00:00
|
|
|
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
|
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# convert packages into references
|
2020-01-30 10:49:50 +00:00
|
|
|
for pkg in $(find . -name '*.deb'); do
|
2020-02-04 19:40:36 +00:00
|
|
|
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
|
2020-01-30 10:49:50 +00:00
|
|
|
rm $pkg
|
|
|
|
done
|
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# 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 LTS kernel"
|
|
|
|
git push --set-upstream origin "${update_branch}"
|