diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eeda77ce..8bcf1203 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/build/build-iso.sh b/build/build-iso.sh index 8aa755f2..80bf3d97 100755 --- a/build/build-iso.sh +++ b/build/build-iso.sh @@ -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 @@ -59,19 +52,19 @@ set +e echo "Making temp vdisk, running auto-install ..." $QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M -$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS +$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..." 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 ..." -$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS +$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS LIMINE_BINARY_BRANCH="v6.x-branch-binary" @@ -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 \ @@ -141,11 +134,11 @@ if [ "$TESTING" = true ]; then cd .. fi echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..." - $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS + $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..." - $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS + $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..." - $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS + $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS fi # comment these 2 lines if you want lingering old Distro ISOs @@ -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:"