2020-01-30 14:22:29 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'arch_lts-*'
|
|
|
|
|
|
|
|
name: Arch LTS
|
|
|
|
|
|
|
|
env:
|
|
|
|
GPG_KEY_ID: 56C464BAAC421453
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build Kernel
|
|
|
|
runs-on: ubuntu-latest
|
2022-01-04 15:11:28 +00:00
|
|
|
container: archlinux
|
2020-01-30 14:22:29 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install build dependencies
|
|
|
|
run: |
|
|
|
|
# Install makepkg deps
|
2020-08-23 20:57:50 +00:00
|
|
|
pacman -Syu --noconfirm
|
2021-01-07 23:34:35 +00:00
|
|
|
pacman -S --noconfirm sudo binutils fakeroot grep base-devel git sbsigntools libffi python
|
2020-01-30 14:22:29 +00:00
|
|
|
|
|
|
|
- name: Setup secureboot certificate
|
|
|
|
env:
|
|
|
|
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
|
|
|
|
run: |
|
|
|
|
cd pkg
|
|
|
|
|
|
|
|
# Install the surface secureboot certificate
|
|
|
|
echo "$SB_KEY" | base64 -d > arch/kernel-lts/MOK.key
|
|
|
|
cp keys/surface.crt arch/kernel-lts/MOK.crt
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
cd pkg/arch/kernel-lts
|
|
|
|
|
|
|
|
# Fix permissions (can't makepkg as root)
|
|
|
|
echo "nobody ALL=(ALL) NOPASSWD: /usr/bin/pacman" >> /etc/sudoers
|
|
|
|
chown -R nobody .
|
|
|
|
|
|
|
|
# Package compression settings (Matches latest Arch)
|
|
|
|
export PKGEXT='.pkg.tar.zst'
|
|
|
|
export COMPRESSZST=(zstd -c -T0 --ultra -20 -)
|
|
|
|
export MAKEFLAGS="-j2"
|
|
|
|
|
|
|
|
# Build
|
|
|
|
su nobody --pty -p -s /bin/bash -c 'makepkg -f --syncdeps --skippgpcheck --noconfirm'
|
|
|
|
|
|
|
|
- name: Prepare release
|
|
|
|
run: |
|
|
|
|
mkdir release
|
|
|
|
mv pkg/arch/kernel-lts/*.pkg.tar.zst release
|
|
|
|
|
|
|
|
- name: Sign packages
|
|
|
|
env:
|
|
|
|
GPG_KEY: ${{ secrets.SURFACE_GPG_KEY }}
|
|
|
|
run: |
|
|
|
|
cd release
|
|
|
|
|
|
|
|
# import GPG key
|
|
|
|
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
|
|
|
|
export GPG_TTY=$(tty)
|
|
|
|
|
|
|
|
# sign packages
|
|
|
|
ls *.pkg.tar.zst | xargs -L1 gpg --detach-sign --batch --no-tty -u $GPG_KEY_ID
|
|
|
|
|
|
|
|
- name: Upload artifacts
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: arch-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: arch-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 14:22:29 +00:00
|
|
|
repo:
|
|
|
|
name: Update package repository
|
2020-02-18 17:57:02 +00:00
|
|
|
needs: [release]
|
2020-01-30 14:22:29 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-01-04 17:35:14 +00:00
|
|
|
container: archlinux
|
2020-01-30 14:22:29 +00:00
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2020-08-24 15:41:25 +00:00
|
|
|
pacman -Syu --noconfirm
|
2020-08-23 20:57:50 +00:00
|
|
|
pacman -S --noconfirm base-devel git
|
2020-01-30 14:22:29 +00:00
|
|
|
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: arch-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 14:22:29 +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 14:22:29 +00:00
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# clone package repository
|
|
|
|
git clone -b "${BRANCH_STAGING}" "${repo}" repo
|
2020-01-30 14:22:29 +00:00
|
|
|
|
2020-02-18 17:46:03 +00:00
|
|
|
# copy packages
|
|
|
|
cp arch-latest/* repo/arch/
|
|
|
|
cd repo/arch
|
|
|
|
|
|
|
|
# parse git tag from ref
|
2020-01-30 14:22:29 +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 14:22:29 +00:00
|
|
|
for pkg in $(find . -name '*.pkg.tar.zst'); do
|
2020-02-04 19:40:36 +00:00
|
|
|
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
|
2020-01-30 14:22:29 +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 Arch Linux LTS kernel"
|
|
|
|
git push --set-upstream origin "${update_branch}"
|