@@ -161,3 +161,78 @@ jobs:
161161 --clobber \
162162 ${{ matrix.target }}.json
163163
164+ deploy-pages :
165+ needs : release
166+ runs-on : ubuntu-latest
167+ permissions :
168+ contents : read
169+ pages : write
170+ id-token : write
171+ environment :
172+ name : github-pages
173+ url : ${{ steps.deployment.outputs.page_url }}
174+
175+ steps :
176+ - name : Get latest release
177+ id : get_release
178+ env :
179+ GH_TOKEN : ${{ github.token }}
180+ run : |
181+ LATEST_TAG=$(gh release list --repo "${{ github.repository }}" --json tagName,isLatest -q '.[] | select(.isLatest == true) | .tagName')
182+ echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
183+
184+ - name : Download all bin files from latest release
185+ env :
186+ GH_TOKEN : ${{ github.token }}
187+ run : |
188+ mkdir -p public
189+ gh release download "${{ steps.get_release.outputs.latest_tag }}" \
190+ --repo "${{ github.repository }}" \
191+ --pattern "*.bin" \
192+ --dir public
193+
194+ - name : Create index.html
195+ run : |
196+ cat > public/index.html << 'EOF'
197+ <!DOCTYPE html>
198+ <html>
199+ <head>
200+ <title>ESP-Hosted MCU Firmware</title>
201+ <style>
202+ body { font-family: Arial, sans-serif; margin: 40px; }
203+ h1 { color: #333; }
204+ ul { list-style-type: none; padding: 0; }
205+ li { margin: 10px 0; }
206+ a { color: #0366d6; text-decoration: none; }
207+ a:hover { text-decoration: underline; }
208+ </style>
209+ </head>
210+ <body>
211+ <h1>ESP-Hosted MCU Firmware - Latest Release</h1>
212+ <p>Release: ${{ steps.get_release.outputs.latest_tag }}</p>
213+ <h2>Available Firmware Files:</h2>
214+ <ul>
215+ EOF
216+
217+ for file in public/*.bin; do
218+ filename=$(basename "$file")
219+ echo " <li><a href=\"$filename\">$filename</a></li>" >> public/index.html
220+ done
221+
222+ cat >> public/index.html << 'EOF'
223+ </ul>
224+ </body>
225+ </html>
226+ EOF
227+
228+ - name : Setup Pages
229+ uses : actions/configure-pages@v4
230+
231+ - name : Upload artifact
232+ uses : actions/upload-pages-artifact@v3
233+ with :
234+ path : ' public'
235+
236+ - name : Deploy to GitHub Pages
237+ id : deployment
238+ uses : actions/deploy-pages@v4
0 commit comments