release方法下载比Artifact更稳定可靠(尤其是国内直连下载) #1
Workflow file for this run
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
name: Build kernel deb packages for openkylin | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
- main | ||
- openkylin | ||
workflow_dispatch: | ||
env: | ||
KERNEL_VERSION: linux-6.9.8 | ||
DEBIAN_FRONTEND: noninteractiv | ||
jobs: | ||
build: | ||
name: Build kernel for openkylin | ||
runs-on: ubuntu-latest | ||
container: ubuntu:focal | ||
steps: | ||
- name: Free Disk Space (Ubuntu) | ||
uses: jlumbroso/free-disk-space@main | ||
with: | ||
# this might remove tools that are actually needed, | ||
# if set to "true" but frees about 6 GB | ||
tool-cache: false | ||
# all of these default to true, but feel free to set to | ||
# "false" if necessary for your workflow | ||
android: true | ||
dotnet: true | ||
haskell: true | ||
large-packages: true | ||
docker-images: true | ||
swap-storage: true | ||
- name: saveSpace | ||
run: rm -rf /opt/hostedtoolcache | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: add deb-src to sources.list | ||
run: | | ||
cat /etc/apt/sources.list | ||
sed -i "/deb-src/s/# //g" /etc/apt/sources.list | ||
cat /etc/apt/sources.list | ||
- name: install dep | ||
run: | | ||
apt update | ||
apt install -y libncurses-dev pkg-config wget git xz-utils make gcc flex bison dpkg-dev bc rsync kmod cpio libssl-dev | ||
apt build-dep -y linux | ||
apt autoremove -y | ||
apt clean -y | ||
- name: Optimize apt cache | ||
run: | | ||
apt clean -y | ||
rm -rf /var/lib/apt/lists/* | ||
- name: download kernel source | ||
run: | | ||
pwd | ||
wget http://www.kernel.org/pub/linux/kernel/v6.x/${{ env.KERNEL_VERSION }}.tar.xz | ||
tar -xf ${{ env.KERNEL_VERSION }}.tar.xz | ||
rm ${{ env.KERNEL_VERSION }}.tar.xz | ||
- name: copy config file | ||
run: | | ||
pwd | ||
cp config ./${{ env.KERNEL_VERSION }}/.config | ||
- name: disable DEBUG_INFO to speedup build | ||
run: | | ||
cd ${{ env.KERNEL_VERSION }} | ||
pwd | ||
scripts/config --disable DEBUG_INFO | ||
scripts/config --enable MODULE_COMPRESS | ||
- name: make git | ||
run: | | ||
cd ${{ env.KERNEL_VERSION }} | ||
git init | ||
git add . | ||
git config --global user.name "Your Name" | ||
git config --global user.email "[email protected]" | ||
git commit -m "1" | ||
- name: build deb packages | ||
run: | | ||
cd ${{ env.KERNEL_VERSION }} | ||
pwd | ||
make oldconfig | ||
DEB_BUILD_OPTIONS=no_dbg make CCACHE_DISABLE=1 deb-pkg -j | ||
- name: move deb packages to artifact dir | ||
run: | | ||
mkdir ${{ github.workspace }}/artifact | ||
# find ${{ github.workspace }} -name "*dbg*.deb" -exec rm -rfv {} \; | ||
find ${{ github.workspace }} -name "*.deb" -exec mv {} ${{ github.workspace }}/artifact \; | ||
tar acvf artifact.tar ${{ github.workspace }}/artifact | ||
- name: Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact | ||
path: ${{ github.workspace }}/artifact.tar | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
${{ github.workspace }}/artifact.tar | ||
tag_name: openkylin | ||
name: kernel |