Build kernel packages #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Build kernel packages | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "master" branch | |
push: | |
tags: | |
- '*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
name: Build packages | |
runs-on: ubuntu-latest | |
container: quay.io/droidian/build-essential:current-amd64 | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
ref: droidian | |
- name: Update repositories | |
run: | | |
apt update | |
apt install linux-packaging-snippets | |
- name: Install package build dependencies | |
run: | | |
package_info=$(head -n 1 debian/changelog) | |
package_name=$(echo "${package_info}" | awk '{ print $1 }') | |
mk-build-deps --remove --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" debian/control | |
rm -f ${package_name}-build-deps_*.* | |
- name: Build package | |
run: | | |
ARGS="--no-lintian -F -d -sa --no-sign --jobs=$(nproc) -aarm64" | |
eval debuild "${ARGS}" | |
- name: Move packages to out directory | |
run: | | |
cp -rf ./prebuiltimages / | |
mkdir /out | |
cp ../*.deb /out/ | |
cp ../*.dsc /out/ | |
cp ../*.tar.xz /out/ | |
cd /out && export bootimagename=$(ls linux-bootimage-4.14-141*) | |
dpkg-deb -R /out/$bootimagename /bootimage | |
cd /bootimage | |
rm boot/dtbo.img-4.14-141-xiaomi-begonia | |
rm boot/recovery.img-4.14-141-xiaomi-begonia | |
cp -f /prebuiltimages/dtbo.img-4.14-141-xiaomi-begonia boot/ | |
cp -f /prebuiltimages/vbmeta.img-4.14-141-xiaomi-begonia boot/ | |
find . -type f -not -path "./DEBIAN/*" -exec md5sum {} + | sort -k 2 | sed 's/\.\/\(.*\)/\1/' > DEBIAN/md5sums | |
cd / | |
rm /out/$bootimagename | |
dpkg-deb -b /bootimage /out/$bootimagename | |
ls /out | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-image | |
path: /out/*.* | |
if-no-files-found: error | |
retention-days: 1 | |
prepare: | |
runs-on: ubuntu-20.04 | |
name: Create GitHub release | |
needs: build | |
steps: | |
- name: Delete old latest release | |
uses: dev-drprasad/[email protected] | |
with: | |
delete_release: true # default: false | |
tag_name: latest # tag name to delete | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tag latest | |
uses: tvdias/[email protected] | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
tag: latest | |
publish: | |
runs-on: ubuntu-20.04 | |
needs: prepare | |
name: Publish linux-image | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: out | |
- name: Create latest release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: out/linux-image/*.* | |
tag_name: latest | |
draft: false | |
prerelease: false |