Build Custom Raspberry Pi Image #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Custom Raspberry Pi Image | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download official Raspberry Pi OS Lite Base Image | |
| run: | | |
| echo "Downloading latest Raspberry Pi OS Lite (64-bit)..." | |
| curl -L -o rpi_base.img.xz "https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-latest/$(curl -s https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-latest/ | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}-raspios-[a-z]+-arm64-lite.img.xz' | head -1)" | |
| xz -d rpi_base.img.xz | |
| - name: Setup QEMU for ARM Emulation | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Modify Raspberry Pi Image | |
| uses: dtcooper/rpi-image-modifier@v1 | |
| with: | |
| image: rpi_base.img | |
| script: deploy/image-setup.sh | |
| env-vars: PI_USERNAME,PI_PASSWORD | |
| env: | |
| PI_USERNAME: ${{ secrets.PI_USERNAME }} | |
| PI_PASSWORD: ${{ secrets.PI_PASSWORD }} | |
| - name: Compress Custom Image | |
| run: | | |
| mv rpi_base.img driverio-custom-raspios-lite.img | |
| xz -9 driverio-custom-raspios-lite.img | |
| - name: Upload Image to GitHub Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: driverio-custom-raspios-lite.img.xz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |