This repository has no description
1name: Raspberry Pi Camera Setup
2
3on:
4 release:
5 types: [published]
6 branches: [main]
7
8jobs:
9 build:
10 runs-on: ubuntu-latest
11
12 steps:
13 - name: Checkout repository
14 uses: actions/checkout@v3
15
16 - name: Create custom stage
17 run: |
18 # Create custom stage directory
19 mkdir -p camera-stage
20
21 # Create packages list
22 cat << EOF > camera-stage/00-packages
23 python3-picamera2
24 python3-websockets
25 EOF
26
27 # Create setup script
28 cat << 'EOF' > camera-stage/01-run-chroot.sh
29 #!/bin/bash -e
30
31 # Create inky user
32 useradd -m -s /bin/bash -G sudo,adm,dialout,cdrom,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky
33 echo "inky:inkycamera" | chpasswd
34
35 # Copy camera files
36 cp /tmp/camera_server.py /home/inky/
37 cp /tmp/camera.service /etc/systemd/system/
38
39 # Set permissions
40 chown -R inky:inky /home/inky
41
42 # Enable service
43 systemctl enable camera.service
44 EOF
45 chmod +x camera-stage/01-run-chroot.sh
46
47 # Create copy files script
48 mkdir -p camera-stage/files
49 cp ./src/camera_server.py camera-stage/files/
50 cp ./src/camera.service camera-stage/files/
51
52 cat << 'EOF' > camera-stage/02-run.sh
53 #!/bin/bash -e
54 cp files/camera_server.py "${ROOTFS_DIR}/tmp/"
55 cp files/camera.service "${ROOTFS_DIR}/tmp/"
56 EOF
57 chmod +x camera-stage/02-run.sh
58
59 - name: Build image
60 uses: usimd/pi-gen-action@v1
61 with:
62 image-name: raspios-camera-ssh-usb
63 stage-list: stage0 stage1 stage2 ./camera-stage
64 enable-ssh: 1
65 hostname: inky
66 username: inky
67 password: inkycamera
68 compression: xz
69
70 - name: Upload image as artifact
71 uses: actions/upload-artifact@v4
72 with:
73 name: raspberry-pi-camera-image
74 path: pi-gen/deploy/*.img.xz
75
76 - name: Upload Release Asset
77 uses: softprops/action-gh-release@v1
78 with:
79 files: pi-gen/deploy/*.img.xz
80 env:
81 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}