-
-
Notifications
You must be signed in to change notification settings - Fork 122
105 lines (94 loc) · 5.13 KB
/
image-builder-from-repo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Build Image from Repo
on:
workflow_dispatch:
inputs:
architecture:
description: 'ARM architecture: armv6l/aarch64'
tagCustomPiOS:
default: ''
description: 'Optional tag of CustomPiOS'
jobs:
build:
runs-on: ubuntu-22.04
env:
HYPERHDR_DEB: 'https://github.com/awawa-dev/HyperHDR/releases/download/v${{ github.event.inputs.tags }}/HyperHDR-${{ github.event.inputs.tags }}-Linux-${{ github.event.inputs.architecture }}.deb'
steps:
- name: Install Dependencies
run: |
sudo apt update
sudo apt install coreutils p7zip-full qemu-user-static xz-utils
- name: Checkout CustomPiOS
uses: actions/checkout@v4.2.2
with:
repository: 'guysoft/CustomPiOS'
ref: '${{ github.event.inputs.tagCustomPiOS }}'
path: CustomPiOS
- name: Prepare HyperHDR module
run: |
cd CustomPiOS
sudo bash -x src/make_custom_pi_os HyperHDR
sudo chown -R runner HyperHDR
- name: Download Raspbian Image (32-bits)
if: github.event.inputs.architecture != 'aarch64'
run: |
mkdir -p CustomPiOS/HyperHDR/src/image
cd CustomPiOS/HyperHDR/src/image
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz'
echo "workspace_dir=CustomPiOS/HyperHDR/src/workspace" >> $GITHUB_ENV
- name: Download Raspbian Image (64-bits)
if: github.event.inputs.architecture == 'aarch64'
run: |
mkdir -p CustomPiOS/HyperHDR/src/image-raspios_lite_arm64
cd CustomPiOS/HyperHDR/src/image-raspios_lite_arm64
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz'
echo "workspace_dir=CustomPiOS/HyperHDR/src/workspace-raspios_lite_arm64" >> $GITHUB_ENV
echo "workspace_variant=raspios_lite_arm64" >> $GITHUB_ENV
- name: Update HyperHDR modules
run: |
cd CustomPiOS/HyperHDR/src
echo 'export DIST_NAME=HyperHDR' > config
echo 'export DIST_VERSION=${{ github.event.inputs.tags }}' >> config
echo 'export MODULES="base(network,hyperhdr)"' >> config
echo 'export RPI_IMAGER_NAME="${DIST_NAME} version ${DIST_VERSION}"' >> config
echo 'export RPI_IMAGER_DESCRIPTION="A Raspberry Pi distribution for ambient lighting. Ships HyperHDR out-of-the-box."' >> config
echo 'export RPI_IMAGER_ICON="https://github.com/awawa-dev/HyperHDR/blob/master/resources/icons/hyperhdr-icon-32px.png"' >> config
echo 'export BASE_IMAGE_ENLARGEROOT=2000' >> config
echo 'export BASE_IMAGE_RESIZEROOT=200' >> config
cd modules/hyperhdr
echo '#!/usr/bin/env bash' > start_chroot_script
echo 'set -x' >> start_chroot_script
echo 'set -e' >> start_chroot_script
echo 'source /common.sh' >> start_chroot_script
echo 'type -p curl >/dev/null || apt install curl -y' >> start_chroot_script
echo 'curl -fsSL https://awawa-dev.github.io/hyperhdr.public.apt.gpg.key | dd of=/usr/share/keyrings/hyperhdr.public.apt.gpg.key \' >> start_chroot_script
echo '&& chmod go+r /usr/share/keyrings/hyperhdr.public.apt.gpg.key \' >> start_chroot_script
echo '&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hyperhdr.public.apt.gpg.key] https://awawa-dev.github.io $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hyperhdr.list > /dev/null \' >> start_chroot_script
echo '&& apt update \' >> start_chroot_script
echo '&& apt install --only-upgrade udev -y \' >> start_chroot_script
echo '&& apt install hyperhdr -y' >> start_chroot_script
echo 'touch /boot/ssh' >> start_chroot_script
echo "echo -n 'pi:' > /boot/userconf" >> start_chroot_script
echo "echo 'raspberry' | openssl passwd -6 -stdin >> /boot/userconf" >> start_chroot_script
echo 'echo "HyperHDR" > /etc/hostname' >> start_chroot_script
echo 'sed -i "s/raspberrypi/HyperHDR/" /etc/hosts' >> start_chroot_script
echo "systemctl -q enable hyperhdr@pi.service" >> start_chroot_script
echo 'sed -i "s/^#dtparam=spi=on.*/dtparam=spi=on/" /boot/config.txt' >> start_chroot_script
echo 'sed -i "s/^#hdmi_force_hotplug=1.*/hdmi_force_hotplug=1/" /boot/config.txt' >> start_chroot_script
chmod +x start_chroot_script
- name: Build HyperHDR Raspbian Image
run: |
sudo modprobe loop
cd CustomPiOS/HyperHDR
sudo bash -x src/build_dist ${{ env.workspace_variant }}
- name: Copy output
id: copy
run: |
IMAGE=SD-card-image-${{ github.event.inputs.tags }}-${{ github.event.inputs.architecture }}
cp ${{ env.workspace_dir }}/*.img $IMAGE.img
xz -v9 $IMAGE.img
echo "image=$IMAGE" >> $GITHUB_OUTPUT
# artifact upload will take care of zipping for us
- uses: actions/upload-artifact@v4.4.3
with:
name: ${{ steps.copy.outputs.image }}
path: ${{ steps.copy.outputs.image }}.img.xz