mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 15:10:28 +00:00
feat: CI build scripts #99 merge and updates
This commit is contained in:
parent
8c3c50983e
commit
cd019bb3ef
2 changed files with 32 additions and 34 deletions
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
|
@ -2,13 +2,15 @@ name: Build Application
|
|||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'stable'
|
||||
branches:
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'screenshots/**'
|
||||
- '**/LICENSE'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'screenshots/**'
|
||||
|
@ -18,7 +20,7 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: self-hosted
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -37,11 +39,14 @@ jobs:
|
|||
./build-iso.sh --headless
|
||||
cd ..
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Releasing latest
|
||||
if: ${{ success() }}
|
||||
uses: "GutPuncher/action-automatic-releases@latest"
|
||||
with:
|
||||
name: ISOs
|
||||
path: |
|
||||
build/*.iso
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "latest"
|
||||
prerelease: false
|
||||
title: "Pre-Built ISOs [${{ github.sha }}]"
|
||||
files: ./build/*.iso
|
||||
if-no-files-found: error
|
||||
|
||||
|
|
|
@ -14,16 +14,9 @@ then
|
|||
fi
|
||||
|
||||
[ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
|
||||
SUDO='none'
|
||||
command -v doas && SUDO=doas
|
||||
command -v sudo && SUDO=sudo
|
||||
if [ "$SUDO" = "none" ] ; then
|
||||
echo 'No sudo or doas installed. Cannot proceed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KVM=''
|
||||
(lsmod | grep -q kvm) && KVM=',accel=kvm'
|
||||
(lsmod | grep -q kvm) && KVM=' -accel kvm'
|
||||
|
||||
# Set this true if you want to test ISOs in QEMU after building.
|
||||
TESTING=false
|
||||
|
@ -37,16 +30,16 @@ TMPMOUNT="$TMPDIR/mnt"
|
|||
QEMU_BIN_PATH=$(dirname "$(which qemu-system-x86_64)")
|
||||
|
||||
mount_tempdisk() {
|
||||
$SUDO modprobe nbd
|
||||
$SUDO $QEMU_BIN_PATH/qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
|
||||
$SUDO partprobe /dev/nbd0
|
||||
$SUDO mount /dev/nbd0p1 $TMPMOUNT
|
||||
sudo modprobe nbd
|
||||
sudo $QEMU_BIN_PATH/qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
|
||||
sudo partprobe /dev/nbd0
|
||||
sudo mount /dev/nbd0p1 $TMPMOUNT
|
||||
}
|
||||
|
||||
umount_tempdisk() {
|
||||
sync
|
||||
$SUDO umount $TMPMOUNT
|
||||
$SUDO $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
|
||||
sudo umount $TMPMOUNT
|
||||
sudo $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
|
||||
}
|
||||
|
||||
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
|
||||
|
@ -66,8 +59,8 @@ rm ../src/Home/Registry.ZC 2> /dev/null
|
|||
rm ../src/Home/MakeHome.ZC 2> /dev/null
|
||||
rm ../src/Boot/Kernel.ZXE 2> /dev/null
|
||||
mount_tempdisk
|
||||
$SUDO mkdir $TMPMOUNT/Tmp/OSBuild/
|
||||
$SUDO cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
|
||||
sudo mkdir $TMPMOUNT/Tmp/OSBuild/
|
||||
sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
|
||||
umount_tempdisk
|
||||
|
||||
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
||||
|
@ -105,7 +98,7 @@ sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-bios-hdd.h | wc -l)\]/g" limine/
|
|||
mount_tempdisk
|
||||
echo "Extracting MyDistro ISO from vdisk ..."
|
||||
cp $TMPMOUNT/Tmp/MyDistro.ISO.C ./ZealOS-MyDistro.iso
|
||||
$SUDO rm $TMPMOUNT/Tmp/MyDistro.ISO.C 2> /dev/null
|
||||
sudo rm $TMPMOUNT/Tmp/MyDistro.ISO.C 2> /dev/null
|
||||
echo "Setting up temp ISO directory contents for use with limine xorriso command ..."
|
||||
sudo cp -rf $TMPMOUNT/* $TMPISODIR
|
||||
sudo rm $TMPISODIR/Boot/OldMBR.BIN 2> /dev/null
|
||||
|
@ -119,8 +112,8 @@ sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
|
|||
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
|
||||
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
|
||||
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
||||
$SUDO mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
||||
$SUDO rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
||||
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
||||
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
||||
umount_tempdisk
|
||||
|
||||
xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-BIOS-CD.BIN \
|
||||
|
@ -156,8 +149,8 @@ mv ./ZealOS-MyDistro.iso ./ZealOS-PublicDomain-BIOS-$(date +%Y-%m-%d-%H_%M_%S).i
|
|||
mv ./ZealOS-limine.iso ./ZealOS-BSD2-UEFI-$(date +%Y-%m-%d-%H_%M_%S).iso
|
||||
|
||||
echo "Deleting temp folder ..."
|
||||
$SUDO rm -rf $TMPDIR
|
||||
$SUDO rm -rf $TMPISODIR
|
||||
sudo rm -rf $TMPDIR
|
||||
sudo rm -rf $TMPISODIR
|
||||
echo "Finished."
|
||||
echo
|
||||
echo "ISOs built:"
|
||||
|
|
Loading…
Reference in a new issue