|
| 1 | +# Build Claude Code Duck firmware variants (Ducky PCB + XIAO Seeed S3) |
| 2 | +# and attach them as merged single-file binaries to a GitHub Release. |
| 3 | +# The web flasher (docs/flash/index.html) references the binaries via |
| 4 | +# the "latest release" URL pattern, so each successful release auto- |
| 5 | +# updates what gets installed when a user clicks Flash on the Claude |
| 6 | +# Code Duck tab. |
| 7 | +# |
| 8 | +# Trigger: push of a tag matching `cc-v*` (e.g., cc-v1.0.0). Hand- |
| 9 | +# trigger: workflow_dispatch from the Actions tab. |
| 10 | +# |
| 11 | +# Note: separate from the bambu firmware workflow so each product |
| 12 | +# moves on its own cadence — `cc-v*` tags fire this one, `bambu-v*` |
| 13 | +# tags fire the bambu one. Same .bin upload pattern, different |
| 14 | +# release assets (cc-ducky.bin / cc-xiao.bin). |
| 15 | +name: Claude Code Duck firmware release |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + tags: |
| 20 | + - 'cc-v*' |
| 21 | + workflow_dispatch: |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write # needed to create releases / upload assets |
| 25 | + |
| 26 | +jobs: |
| 27 | + build-and-release: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + include: |
| 33 | + - variant: ducky |
| 34 | + sketch_dir: firmware/rubber_duck_s3_ducky |
| 35 | + sketch_file: rubber_duck_s3_ducky.ino |
| 36 | + asset_name: cc-ducky.bin |
| 37 | + label: Claude Code Duck — Ducky PCB |
| 38 | + - variant: xiao |
| 39 | + sketch_dir: firmware/rubber_duck_s3 |
| 40 | + sketch_file: rubber_duck_s3.ino |
| 41 | + asset_name: cc-xiao.bin |
| 42 | + label: Claude Code Duck — XIAO Seeed S3 |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Install arduino-cli |
| 48 | + run: | |
| 49 | + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$HOME/bin sh |
| 50 | + echo "$HOME/bin" >> $GITHUB_PATH |
| 51 | +
|
| 52 | + - name: Install ESP32 board package |
| 53 | + run: | |
| 54 | + arduino-cli config init |
| 55 | + arduino-cli config add board_manager.additional_urls \ |
| 56 | + https://espressif.github.io/arduino-esp32/package_esp32_index.json |
| 57 | + arduino-cli core update-index |
| 58 | + # Pin to a known-good ESP32 core. Bump deliberately when |
| 59 | + # validating against a newer arduino-esp32 release. |
| 60 | + arduino-cli core install esp32:esp32@3.0.7 |
| 61 | +
|
| 62 | + - name: Install esptool (for merge_bin) |
| 63 | + run: pip install esptool |
| 64 | + |
| 65 | + - name: Compile ${{ matrix.label }} |
| 66 | + # FQBN: esp32:esp32:esp32s3 with USB CDC on boot so the chip |
| 67 | + # appears as /dev/cu.usbmodem* without an external UART bridge. |
| 68 | + # PSRAM=opi for the WROOM-1 (ducky PCB) — XIAO Sense's S3 also |
| 69 | + # has PSRAM enabled in its default partition. PartitionScheme |
| 70 | + # default_8MB to match the 8MB flash on both boards. |
| 71 | + run: | |
| 72 | + arduino-cli compile \ |
| 73 | + --fqbn 'esp32:esp32:esp32s3:USBMode=hwcdc,CDCOnBoot=cdc,PartitionScheme=default_8MB,FlashSize=8M,PSRAM=opi' \ |
| 74 | + --output-dir build_${{ matrix.variant }} \ |
| 75 | + --build-property 'build.extra_flags=-DUSB_MANUFACTURER="IDEO" -DUSB_PRODUCT="Duck Duck Duck"' \ |
| 76 | + ${{ matrix.sketch_dir }} |
| 77 | +
|
| 78 | + - name: Merge into single flashable image |
| 79 | + # arduino-cli output: <sketch>.ino.bootloader.bin / |
| 80 | + # .partitions.bin / .ino.bin. Merge into one offset-0 binary |
| 81 | + # so the ESP Web Tools manifest can reference a single file. |
| 82 | + run: | |
| 83 | + cd build_${{ matrix.variant }} |
| 84 | + ls -la |
| 85 | + BOOT=$(ls *.bootloader.bin | head -n1) |
| 86 | + PART=$(ls *.partitions.bin | head -n1) |
| 87 | + APP=$(ls *.ino.bin | head -n1) |
| 88 | + esptool.py --chip esp32s3 merge_bin \ |
| 89 | + -o ../${{ matrix.asset_name }} \ |
| 90 | + --flash_mode dio --flash_size 8MB --flash_freq 80m \ |
| 91 | + 0x0 "$BOOT" \ |
| 92 | + 0x8000 "$PART" \ |
| 93 | + 0x10000 "$APP" |
| 94 | + cd .. |
| 95 | + ls -la ${{ matrix.asset_name }} |
| 96 | +
|
| 97 | + - name: Upload merged binary as artifact |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: ${{ matrix.asset_name }} |
| 101 | + path: ${{ matrix.asset_name }} |
| 102 | + if-no-files-found: error |
| 103 | + |
| 104 | + release: |
| 105 | + needs: build-and-release |
| 106 | + runs-on: ubuntu-latest |
| 107 | + if: startsWith(github.ref, 'refs/tags/cc-v') |
| 108 | + steps: |
| 109 | + - uses: actions/checkout@v4 |
| 110 | + - name: Download all variant binaries |
| 111 | + uses: actions/download-artifact@v4 |
| 112 | + with: |
| 113 | + path: dist |
| 114 | + |
| 115 | + - name: Flatten artifact dir layout |
| 116 | + run: | |
| 117 | + mkdir -p release |
| 118 | + find dist -name '*.bin' -exec cp {} release/ \; |
| 119 | + ls -la release/ |
| 120 | +
|
| 121 | + - name: Create / update GitHub Release |
| 122 | + uses: softprops/action-gh-release@v2 |
| 123 | + with: |
| 124 | + name: Claude Code Duck firmware ${{ github.ref_name }} |
| 125 | + files: release/*.bin |
| 126 | + generate_release_notes: true |
| 127 | + body: | |
| 128 | + Pre-built firmware binaries for the Claude Code Duck (Mac |
| 129 | + companion that watches your Claude Code session and |
| 130 | + reacts via voice + servo + LED). |
| 131 | +
|
| 132 | + **Flash from a browser:** https://ideo.github.io/Rubber-Duck/flash/ |
| 133 | + (Chrome / Edge — uses WebSerial, no install needed.) |
| 134 | +
|
| 135 | + **Flash from the command line:** |
| 136 | + ``` |
| 137 | + python -m esptool --chip esp32s3 -p /dev/cu.usbmodem101 \ |
| 138 | + write_flash 0x0 cc-ducky.bin |
| 139 | + ``` |
| 140 | +
|
| 141 | + Variants: |
| 142 | + - `cc-ducky.bin` — official IDEO Duck PCB (custom WROOM-1) |
| 143 | + - `cc-xiao.bin` — DIY build on standard XIAO Seeed ESP32-S3 |
0 commit comments