2022-10-14 13:41:18 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'fedora-37-*'
|
|
|
|
|
|
|
|
name: Fedora 37
|
|
|
|
|
|
|
|
env:
|
|
|
|
GPG_KEY_ID: 56C464BAAC421453
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build Kernel
|
|
|
|
runs-on: ubuntu-latest
|
2023-06-08 18:03:17 +00:00
|
|
|
container: registry.fedoraproject.org/fedora:37
|
2022-10-14 13:41:18 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-10-14 13:41:18 +00:00
|
|
|
|
|
|
|
- name: Install build dependencies
|
|
|
|
run: |
|
|
|
|
dnf distro-sync -y
|
2023-05-14 08:44:51 +00:00
|
|
|
dnf install -y git make gcc flex bison bzip2 rpm-build
|
2022-10-14 13:41:18 +00:00
|
|
|
dnf install -y rpmdevtools rpm-sign 'dnf-command(builddep)'
|
2023-05-14 08:44:51 +00:00
|
|
|
|
|
|
|
# Install build dependencies
|
|
|
|
dnf builddep -y kernel
|
|
|
|
|
|
|
|
# Install additional build dependencies
|
|
|
|
dnf install -y sbsigntools
|
2022-10-14 13:41:18 +00:00
|
|
|
|
|
|
|
- name: Setup secureboot certificate
|
|
|
|
env:
|
|
|
|
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
|
|
|
|
run: |
|
|
|
|
# Install the surface secureboot certificate
|
2023-05-14 08:44:51 +00:00
|
|
|
echo "$SB_KEY" | base64 -d > pkg/fedora/kernel-surface/secureboot/MOK.key
|
|
|
|
cp pkg/keys/surface.crt pkg/fedora/kernel-surface/secureboot/MOK.crt
|
2022-10-14 13:41:18 +00:00
|
|
|
|
|
|
|
- name: Build packages
|
|
|
|
run: |
|
|
|
|
cd pkg/fedora/kernel-surface
|
|
|
|
|
2023-05-14 08:44:51 +00:00
|
|
|
# setup git
|
|
|
|
git config --global user.email "surfacebot@users.noreply.github.com"
|
|
|
|
git config --global user.name "surfacebot"
|
|
|
|
|
2023-06-08 18:02:26 +00:00
|
|
|
# Build source RPM packages
|
|
|
|
python3 build-linux-surface.py --mode srpm --ark-dir kernel-ark --outdir srpm
|
|
|
|
|
|
|
|
# Remove the kernel-ark tree to get as much free disk space as possible
|
|
|
|
rm -rf kernel-ark
|
|
|
|
|
|
|
|
# Build binary RPM packages
|
|
|
|
rpmbuild -rb --define "_rpmdir $PWD/out" srpm/*.src.rpm
|
2022-10-14 13:41:18 +00:00
|
|
|
|
|
|
|
- name: Sign packages
|
|
|
|
env:
|
2023-06-03 10:36:42 +00:00
|
|
|
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
|
2022-10-14 13:41:18 +00:00
|
|
|
run: |
|
|
|
|
cd pkg/fedora/kernel-surface/out/x86_64
|
|
|
|
|
|
|
|
# import GPG key
|
|
|
|
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
|
|
|
|
|
|
|
|
# sign packages
|
|
|
|
rpm --resign *.rpm --define "_gpg_name $GPG_KEY_ID"
|
|
|
|
|
|
|
|
- name: Upload artifacts
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-10-14 13:41:18 +00:00
|
|
|
with:
|
|
|
|
name: fedora-37-latest
|
|
|
|
path: pkg/fedora/kernel-surface/out/x86_64
|
|
|
|
|
|
|
|
release:
|
|
|
|
name: Publish release
|
|
|
|
needs: [build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2022-10-14 13:41:18 +00:00
|
|
|
with:
|
|
|
|
name: fedora-37-latest
|
2023-02-02 00:05:42 +00:00
|
|
|
path: fedora-37-latest
|
2022-10-14 13:41:18 +00:00
|
|
|
|
|
|
|
- name: Upload assets
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: svenstaro/upload-release-action@v2
|
2022-10-14 13:41:18 +00:00
|
|
|
with:
|
2023-06-03 10:36:42 +00:00
|
|
|
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
|
2022-10-14 13:41:18 +00:00
|
|
|
file: ./*-latest/*
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
file_glob: true
|
|
|
|
|
|
|
|
repo:
|
|
|
|
name: Update package repository
|
|
|
|
needs: [release]
|
|
|
|
runs-on: ubuntu-latest
|
2023-06-08 18:03:17 +00:00
|
|
|
container: registry.fedoraproject.org/fedora:37
|
2022-10-14 13:41:18 +00:00
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
dnf install -y git findutils
|
|
|
|
|
|
|
|
- name: Download artifacts
|
2023-02-02 00:05:42 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2022-10-14 13:41:18 +00:00
|
|
|
with:
|
|
|
|
name: fedora-37-latest
|
2023-02-02 00:05:42 +00:00
|
|
|
path: fedora-37-latest
|
2022-10-14 13:41:18 +00:00
|
|
|
|
|
|
|
- name: Update repository
|
|
|
|
env:
|
2023-06-03 10:36:42 +00:00
|
|
|
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
|
2022-10-14 13:41:18 +00:00
|
|
|
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 fedora-37-latest/* repo/fedora/f37
|
|
|
|
cd repo/fedora/f37
|
|
|
|
|
|
|
|
# parse git tag from ref
|
|
|
|
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
|
|
|
|
|
|
|
|
# convert packages into references
|
|
|
|
for pkg in $(find . -name '*.rpm'); 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 checkout -b "${update_branch}"
|
|
|
|
git add .
|
|
|
|
git commit -m "Update Fedora 37 kernel"
|
|
|
|
git push --set-upstream origin "${update_branch}"
|