···
- name: Checkout repository
uses: actions/checkout@v3
+
- name: Modify Raspberry Pi OS Image
+
uses: dtcooper/rpi-image-modifier@v1
+
base-image-url: https://downloads.raspberrypi.org/raspios_lite_armhf_latest
+
image-path: raspios-camera-ssh-usb.img
+
# Set locale and timezone
+
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
+
update-locale LANG=en_US.UTF-8
+
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
+
# Create inky user first
+
useradd -m -s /bin/bash -G sudo,adm,dialout,cdrom,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky
+
echo "inky:inkycamera" | chpasswd
+
echo "inky" > /etc/hostname
+
sed -i 's/raspberrypi/inky/' /etc/hosts
+
# Now copy camera files since /home/inky exists
+
cp -v /mounted-github-repo/src/camera_server.py /home/inky/camera_server.py
+
cp -v /mounted-github-repo/src/camera.service /etc/systemd/system/camera.service
+
chown -R inky:inky /home/inky
+
# Configure SSH over USB
+
echo "dtoverlay=dwc2" >> /boot/config.txt
+
sed -i 's/rootwait/rootwait modules-load=dwc2,g_ether/' /boot/cmdline.txt
+
cat << 'EEOF' > /home/inky/setup.sh
+
sudo systemctl daemon-reload
+
sudo systemctl enable camera.service
+
sudo systemctl start camera.service
+
chmod +x /home/inky/setup.sh
+
# Create and configure rc.local
+
cat << 'EOF' > /etc/rc.local
+
# Install required packages
+
apt-get install -y python3-picamera2 python3-websockets
- name: Upload image as artifact
uses: actions/upload-artifact@v4
name: raspberry-pi-camera-image
+
path: ${{ steps.create-image.outputs.image-path }}
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
+
files: ${{ steps.create-image.outputs.image-path }}
+
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}