Skip to content

Commit f6bd792

Browse files
committed
Add pages-only workflow to publish web flasher from a release
1 parent 5beb0cd commit f6bd792

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Pages Web Flasher (Release Assets)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: "Release tag to publish to GitHub Pages (example: v1.3.4)"
8+
required: true
9+
10+
jobs:
11+
pages:
12+
name: Deploy Web Flasher (Pages)
13+
runs-on: ubuntu-24.04
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
environment:
19+
name: github-pages
20+
url: ${{ steps.deployment.outputs.page_url }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Pages
26+
uses: actions/configure-pages@v4
27+
with:
28+
enablement: true
29+
30+
- name: Download release assets
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
TAG: ${{ inputs.release_tag }}
34+
run: |
35+
set -euo pipefail
36+
rm -rf docs/firmware
37+
mkdir -p docs/firmware
38+
39+
gh release download "$TAG" -R "$GITHUB_REPOSITORY" --dir docs/firmware \
40+
--pattern "bootloader.bin" \
41+
--pattern "partition-table.bin" \
42+
--pattern "projectZero*.bin"
43+
44+
ls -lh docs/firmware
45+
46+
if [ ! -f docs/firmware/projectZero.bin ]; then
47+
alt=$(ls docs/firmware/projectZero-*.bin 2>/dev/null | head -n1 || true)
48+
if [ -n "$alt" ]; then
49+
cp "$alt" docs/firmware/projectZero.bin
50+
fi
51+
fi
52+
53+
for f in bootloader.bin partition-table.bin projectZero.bin; do
54+
if [ ! -f "docs/firmware/$f" ]; then
55+
echo "Missing $f in release assets for tag ${TAG}" >&2
56+
exit 1
57+
fi
58+
done
59+
60+
- name: Build manifest.json
61+
env:
62+
TAG: ${{ inputs.release_tag }}
63+
run: |
64+
set -euo pipefail
65+
python -c "import os, json; from pathlib import Path; tag=os.getenv('TAG','manual'); manifest={'name':'projectZero ESP32-C5','version':tag,'build':tag,'chipFamily':'ESP32-C5','parts':[{'path':'firmware/bootloader.bin','offset':8192},{'path':'firmware/partition-table.bin','offset':32768},{'path':'firmware/projectZero.bin','offset':131072}]}; Path('docs/manifest.json').write_text(json.dumps(manifest, indent=2) + '\\n')"
66+
67+
- name: Upload Pages artifact
68+
uses: actions/upload-pages-artifact@v3
69+
with:
70+
path: docs
71+
72+
- name: Deploy to GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v4
75+

0 commit comments

Comments
 (0)