1+ name : Build Tastic Firmware
2+
3+ on :
4+ push :
5+ branches : [tastic]
6+ tags :
7+ - ' tastic-v*'
8+ workflow_dispatch :
9+ inputs :
10+ boards :
11+ description : ' Boards to build (comma-separated)'
12+ required : false
13+ default : ' tracker-t1000-e,seeed_xiao_nrf52840_kit,heltec-v3,rak4631'
14+
15+ env :
16+ DEFAULT_BOARDS : ' tracker-t1000-e,seeed_xiao_nrf52840_kit,heltec-v3,rak4631'
17+
18+ jobs :
19+ build :
20+ runs-on : ubuntu-latest
21+ strategy :
22+ fail-fast : false
23+ matrix :
24+ board : [tracker-t1000-e, seeed_xiao_nrf52840_kit, heltec-v3, rak4631]
25+
26+ steps :
27+ - uses : actions/checkout@v4
28+ with :
29+ ref : tastic
30+ submodules : recursive
31+
32+ - name : Setup Python
33+ uses : actions/setup-python@v4
34+ with :
35+ python-version : ' 3.10'
36+
37+ - name : Cache PlatformIO
38+ uses : actions/cache@v3
39+ with :
40+ path : |
41+ ~/.platformio
42+ ~/.cache/pip
43+ key : ${{ runner.os }}-pio-${{ matrix.board }}-${{ hashFiles('platformio.ini') }}
44+
45+ - name : Install PlatformIO
46+ run : |
47+ pip install --upgrade pip
48+ pip install platformio
49+ platformio pkg update -g
50+
51+ - name : Build firmware for ${{ matrix.board }}
52+ run : |
53+ echo "Building ${{ matrix.board }}"
54+ platformio run -e ${{ matrix.board }}
55+
56+ - name : Package firmware
57+ run : |
58+ mkdir -p release/${{ matrix.board }}
59+
60+ # Copy .bin files for ESP32 boards (heltec-v3)
61+ if [[ "${{ matrix.board }}" == "heltec-v3" ]]; then
62+ cp .pio/build/${{ matrix.board }}/*.bin release/${{ matrix.board }}/ || true
63+ cp .pio/build/${{ matrix.board }}/firmware.factory.bin release/${{ matrix.board }}/ || true
64+ cp .pio/build/${{ matrix.board }}/firmware.bin release/${{ matrix.board }}/ || true
65+ cp .pio/build/${{ matrix.board }}/littlefs.bin release/${{ matrix.board }}/ || true
66+ fi
67+
68+ # Copy .uf2/.hex files for nRF52 boards (tracker, xiao, and rak4631)
69+ if [[ "${{ matrix.board }}" == "tracker-t1000-e" ]] || [[ "${{ matrix.board }}" == "seeed_xiao_nrf52840_kit" ]] || [[ "${{ matrix.board }}" == "rak4631" ]]; then
70+ cp .pio/build/${{ matrix.board }}/*.uf2 release/${{ matrix.board }}/ || true
71+ cp .pio/build/${{ matrix.board }}/*.hex release/${{ matrix.board }}/ || true
72+ cp .pio/build/${{ matrix.board }}/firmware.uf2 release/${{ matrix.board }}/ || true
73+ fi
74+
75+ # Create a zip for this board
76+ cd release
77+ zip -r firmware-${{ matrix.board }}-${GITHUB_SHA::7}.zip ${{ matrix.board }}
78+
79+ - name : Upload artifacts
80+ uses : actions/upload-artifact@v4
81+ with :
82+ name : firmware-${{ matrix.board }}
83+ path : release/*.zip
84+ retention-days : 30
85+
86+ release :
87+ needs : build
88+ runs-on : ubuntu-latest
89+ if : startsWith(github.ref, 'refs/tags/tastic-v')
90+
91+ steps :
92+ - uses : actions/checkout@v4
93+
94+ - name : Download all artifacts
95+ uses : actions/download-artifact@v4
96+ with :
97+ path : firmware-artifacts
98+
99+ - name : Prepare release files
100+ run : |
101+ mkdir -p release-files
102+ version="${GITHUB_REF#refs/tags/}"
103+
104+ # Collect all firmware zips
105+ for dir in firmware-artifacts/firmware-*; do
106+ if [ -d "$dir" ]; then
107+ board=$(basename "$dir" | sed 's/firmware-//')
108+ cp "$dir"/*.zip "release-files/firmware-${board}-${version}.zip"
109+ fi
110+ done
111+
112+ # Create combined zip
113+ cd release-files
114+ mkdir -p all-firmware
115+ for zip in *.zip; do
116+ unzip -o "$zip" -d all-firmware/
117+ done
118+ zip -r "tastic-firmware-${version}-all.zip" all-firmware/
119+
120+ - name : Create Release
121+ uses : softprops/action-gh-release@v1
122+ with :
123+ name : Tastic Firmware ${{ github.ref_name }}
124+ body : |
125+ ## Tastic Mesh Firmware Release
126+
127+ Built from the `tastic` branch.
128+
129+ ### Included Boards:
130+ - RAK4631 WisBlock Core (`rak4631`) - nRF52840
131+ - Seeed XIAO nRF52840 Kit (`seeed_xiao_nrf52840_kit`) - nRF52840
132+ - Seeed SenseCAP Card Tracker T1000-E (`tracker-t1000-e`) - nRF52840
133+ - Heltec WiFi LoRa 32 V3 (`heltec-v3`) - ESP32-S3
134+
135+ ### Installation:
136+ Flash using the Tastic Web Flasher or manually with the appropriate tool for your device.
137+
138+ Commit: ${{ github.sha }}
139+ files : release-files/*.zip
140+ draft : false
141+ prerelease : false
142+ env :
143+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
144+
145+ - name : Extract firmware for GitHub Pages
146+ run : |
147+ mkdir -p gh-pages-content
148+ version="${GITHUB_REF#refs/tags/}"
149+
150+ echo "========================================="
151+ echo "Extracting firmware files for version: $version"
152+ echo "========================================="
153+
154+ # Process each board's ZIP file
155+ for zip in release-files/firmware-*.zip; do
156+ if [ -f "$zip" ]; then
157+ echo ""
158+ echo "Processing ZIP: $zip"
159+ echo "-----------------------------------------"
160+
161+ # Extract board name from filename: firmware-{board}-{version}.zip
162+ board=$(basename "$zip" | sed "s/firmware-\(.*\)-${version}\.zip/\1/")
163+ echo "Extracted board name: $board"
164+
165+ # Create temp directory for extraction
166+ temp_dir="temp_${board}"
167+ mkdir -p "$temp_dir"
168+
169+ # Extract and show contents
170+ echo "Extracting ZIP to $temp_dir..."
171+ unzip -q "$zip" -d "$temp_dir"
172+
173+ echo "ZIP contents:"
174+ find "$temp_dir" -type f -name "*.bin" -o -name "*.uf2" -o -name "*.hex" | head -20
175+
176+ # The ZIP contains a board directory, so let's find all firmware files
177+ echo ""
178+ echo "Looking for firmware files..."
179+
180+ # Find all relevant files and copy them with proper names
181+ find "$temp_dir" -type f \( -name "*.bin" -o -name "*.uf2" -o -name "*.hex" \) | while read -r file; do
182+ filename=$(basename "$file")
183+ echo "Found: $filename at $file"
184+
185+ case "$filename" in
186+ firmware.bin)
187+ dest="gh-pages-content/firmware-${board}-${version}.bin"
188+ cp "$file" "$dest"
189+ echo " → Copied to: firmware-${board}-${version}.bin"
190+ ;;
191+ firmware.factory.bin)
192+ dest="gh-pages-content/firmware-${board}-${version}.factory.bin"
193+ cp "$file" "$dest"
194+ echo " → Copied to: firmware-${board}-${version}.factory.bin"
195+ ;;
196+ firmware.uf2)
197+ dest="gh-pages-content/firmware-${board}-${version}.uf2"
198+ cp "$file" "$dest"
199+ echo " → Copied to: firmware-${board}-${version}.uf2"
200+ ;;
201+ firmware.hex)
202+ dest="gh-pages-content/firmware-${board}-${version}.hex"
203+ cp "$file" "$dest"
204+ echo " → Copied to: firmware-${board}-${version}.hex"
205+ ;;
206+ littlefs.bin|spiffs*.bin)
207+ dest="gh-pages-content/littlefs-${board}-${version}.bin"
208+ cp "$file" "$dest"
209+ echo " → Copied to: littlefs-${board}-${version}.bin"
210+ ;;
211+ bootloader.bin|bootloader-*.bin)
212+ dest="gh-pages-content/bootloader-${board}-${version}.bin"
213+ cp "$file" "$dest"
214+ echo " → Copied to: bootloader-${board}-${version}.bin"
215+ ;;
216+ partitions.bin|partitions-*.bin)
217+ dest="gh-pages-content/partitions-${board}-${version}.bin"
218+ cp "$file" "$dest"
219+ echo " → Copied to: partitions-${board}-${version}.bin"
220+ ;;
221+ *.bin|*.uf2|*.hex)
222+ echo " ⚠ Unhandled file: $filename"
223+ ;;
224+ esac
225+ done
226+
227+ # Clean up temp directory
228+ rm -rf "$temp_dir"
229+ echo "Cleaned up $temp_dir"
230+ fi
231+ done
232+
233+ echo ""
234+ echo "========================================="
235+ echo "Files to be deployed to GitHub Pages:"
236+ echo "========================================="
237+ ls -la gh-pages-content/
238+
239+ # Create index.json
240+ cd gh-pages-content
241+ echo "{\"version\":\"$version\",\"boards\":[\"tracker-t1000-e\",\"seeed_xiao_nrf52840_kit\",\"heltec-v3\",\"rak4631\"],\"timestamp\":\"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"}" > index.json
242+ echo ""
243+ echo "Created index.json"
244+
245+ - name : Deploy to GitHub Pages
246+ uses : peaceiris/actions-gh-pages@v3
247+ with :
248+ github_token : ${{ secrets.GITHUB_TOKEN }}
249+ publish_dir : ./gh-pages-content
250+ destination_dir : firmware/${{ github.ref_name }}
0 commit comments