Skip to content

Commit

Permalink
Add GitHub actions workflow to build release ISOs
Browse files Browse the repository at this point in the history
Related to #134

Add a GitHub actions workflow to build release ISOs for intel desktop.

* **New GitHub Actions Workflow:**
  - Add `release-isos.yml` to `.github/workflows/` to build release ISOs.
  - Trigger on push and pull_request events for `master`, `next`, `stable`, and `staging` branches.
  - Include steps to build the `intel/desktop` configuration, create an ISO image, and upload the ISO as a GitHub artifact.

* **Build ISO Script:**
  - Add `configs/intel/desktop/scripts/build_iso.sh` to create an ISO image using `mkisofs`.
  - Save the ISO to the specified output path.

* **Makefile Changes:**
  - Add a new target `isoimage` in `configs/intel/desktop/extensions/Makefile` to call the `build_iso.sh` script.

* **Documentation Update:**
  - Update `configs/intel/desktop/README.md` to include instructions for building an ISO.

* **Build Image Script:**
  - Modify `configs/intel/desktop/scripts/build_image.sh` to create an ISO image instead of a sparse image.
  • Loading branch information
paralin committed Dec 10, 2024
1 parent ab1c146 commit 284ac3b
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 23 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release-isos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release ISOs

on:
push:
branches: [master, next, stable, staging]
pull_request:
branches: [master, next, stable, staging]

jobs:
build:
runs-on: ubuntu-latest
env:
'SKIFF_WORKSPACE': intel-desktop
'SKIFF_CONFIG': intel/desktop,skiff/core
steps:
- uses: actions/checkout@v4
- name: Update the submodule
run: |
cd $GITHUB_WORKSPACE
git submodule update --init --recursive
- name: Cache build cache and downloads
uses: actions/cache@v4
with:
path: ~/br-cache/
key: buildroot-r1-h${{ hashFiles('buildroot/Makefile') }}-ubuntu-latest
restore-keys: |
buildroot-r1
- name: Install buildroot apt deps
run: |
sudo apt-get install -y libelf-dev python3-magic python3-flake8
- name: Print help and packages list
run: |
cd $GITHUB_WORKSPACE
make help
- name: Enable using a pre-built toolchain
run: |
cd $GITHUB_WORKSPACE
echo "BR2_TOOLCHAIN_EXTERNAL=y" > ./overrides/buildroot/toolchain
- name: Compile the OS
run: |
cd $GITHUB_WORKSPACE
export TERM=xterm
export BR2_CCACHE_DIR=${HOME}/br-cache/ccache
export BR2_DL_DIR=${HOME}/br-cache/dl
make -s configure compile check
- name: Create an ISO image
run: |
cd $GITHUB_WORKSPACE
make cmd/intel/desktop/buildiso
mkdir -p workflow-artifacts
mv ./intel-desktop-image.iso ./workflow-artifacts/intel-desktop-image.iso
- name: Upload ISO image artifact
uses: actions/upload-artifact@v4
with:
name: intel-desktop-image.iso
path: ${{ github.workspace }}/workflow-artifacts/intel-desktop-image.iso
17 changes: 17 additions & 0 deletions configs/intel/desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,20 @@ dd if=intel-desktop-image.img of=/dev/sdX status=progress oflag=sync
This is equivalent to using the format and install scripts.

The persist partition will be resized to fill the available space on first boot.

## Building an ISO

It's possible to create an ISO image from the built .img file.

```sh
# must be root to use losetup
sudo bash
# set your skiff workspace
export SKIFF_WORKSPACE=default
# set the output path
export INTEL_DESKTOP_IMAGE=./intel-desktop-image.img
# make the ISO
make cmd/intel/desktop/buildiso
```

The ISO image will be created at the specified output path.
4 changes: 4 additions & 0 deletions configs/intel/desktop/extensions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ buildimage:

# alias to buildimage
create-image: buildimage

# Create an ISO image from the built image
isoimage:
@$(SKIFF_CURRENT_CONF_DIR)/scripts/build_iso.sh
26 changes: 3 additions & 23 deletions configs/intel/desktop/scripts/build_image.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,7 @@ if [[ "$INTEL_DESKTOP_IMAGE" != /* ]]; then
INTEL_DESKTOP_IMAGE=$SKIFF_ROOT_DIR/$INTEL_DESKTOP_IMAGE
fi

echo "Allocating sparse image..."
fallocate -l 1.5G $INTEL_DESKTOP_IMAGE
echo "Creating ISO image..."
genisoimage -o $INTEL_DESKTOP_IMAGE.iso -b boot/grub/i386-pc/eltorito.img -c boot.catalog -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "SkiffOS" $SKIFF_CURRENT_CONF_DIR/resources

echo "Setting up loopback device..."
export INTEL_DESKTOP_DISK=$(losetup --show -fP $INTEL_DESKTOP_IMAGE)
function cleanup {
echo "Removing loopback device..." || true
sync || true
losetup -d $INTEL_DESKTOP_DISK || true
}
trap cleanup EXIT

if [ -z "${INTEL_DESKTOP_DISK}" ] || [ ! -b ${INTEL_DESKTOP_DISK} ]; then
echo "Failed to setup loop device."
exit 1
fi

# Setup no interactive since we know its a brand new file.
export SKIFF_NO_INTERACTIVE=1
export DISABLE_CREATE_SWAPFILE=1

echo "Using loopback device at ${INTEL_DESKTOP_DISK}"
$SKIFF_CURRENT_CONF_DIR/scripts/format_sd.sh
$SKIFF_CURRENT_CONF_DIR/scripts/install_sd.sh
echo "ISO image created at $INTEL_DESKTOP_IMAGE.iso"
23 changes: 23 additions & 0 deletions configs/intel/desktop/scripts/build_iso.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ $EUID != 0 ]; then
echo "This script requires sudo, so it might not work."
fi

set -e

if [ -z "$INTEL_DESKTOP_IMAGE" ]; then
echo "Please set INTEL_DESKTOP_IMAGE to the path to the output image."
exit 1
fi

if [[ "$INTEL_DESKTOP_IMAGE" != /* ]]; then
# the "make" command is run from the skiff root,
# it's most intuitive to take that as the base path
INTEL_DESKTOP_IMAGE=$SKIFF_ROOT_DIR/$INTEL_DESKTOP_IMAGE
fi

echo "Creating ISO image..."
mkisofs -o $INTEL_DESKTOP_IMAGE.iso -b boot/grub/i386-pc/eltorito.img -c boot.catalog -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "SkiffOS" $SKIFF_CURRENT_CONF_DIR/resources

echo "ISO image created at $INTEL_DESKTOP_IMAGE.iso"

0 comments on commit 284ac3b

Please sign in to comment.