Skip to content

Commit 5dd8f84

Browse files
committed
Fix manifest: use separate release, correct URLs, validate SHA256
1 parent 3ab5350 commit 5dd8f84

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
5353
- name: Prepare artifacts
5454
run: |
55-
mkdir -p artifacts/${{ env.ESP_HOSTED_VERSION }}
56-
cp slave/build/network_adapter.bin artifacts/${{ env.ESP_HOSTED_VERSION }}/network_adapter_${{ matrix.target }}.bin
57-
sha256sum artifacts/${{ env.ESP_HOSTED_VERSION }}/network_adapter_${{ matrix.target }}.bin > artifacts/${{ env.ESP_HOSTED_VERSION }}/network_adapter_${{ matrix.target }}.bin.sha256
55+
mkdir -p artifacts
56+
cp slave/build/network_adapter.bin artifacts/network_adapter_${{ matrix.target }}.bin
57+
sha256sum artifacts/network_adapter_${{ matrix.target }}.bin > artifacts/network_adapter_${{ matrix.target }}.bin.sha256
5858
5959
- name: Upload artifacts
6060
uses: actions/upload-artifact@v4
@@ -80,7 +80,7 @@ jobs:
8080
uses: softprops/action-gh-release@v2
8181
with:
8282
tag_name: v${{ env.ESP_HOSTED_VERSION }}
83-
files: firmware/**/*
83+
files: firmware/*
8484
generate_release_notes: true
8585

8686
manifest:
@@ -111,14 +111,19 @@ jobs:
111111
echo '{"versions":[]}' > manifest.json
112112
113113
for TAG in $TAGS; do
114+
# Skip manifest tag
115+
if [ "$TAG" = "manifest" ]; then
116+
continue
117+
fi
118+
114119
VERSION="${TAG#v}"
115120
116121
# Get SHA256 from release asset
117-
SHA256_URL="https://github.com/${REPO}/releases/download/${TAG}/${VERSION}/network_adapter_${TARGET}.bin.sha256"
122+
SHA256_URL="https://github.com/${REPO}/releases/download/${TAG}/network_adapter_${TARGET}.bin.sha256"
118123
SHA256=$(curl -sL "$SHA256_URL" 2>/dev/null | awk '{print $1}')
119124
120-
if [ -n "$SHA256" ] && [ "$SHA256" != "404:" ]; then
121-
BIN_URL="https://github.com/${REPO}/releases/download/${TAG}/${VERSION}/network_adapter_${TARGET}.bin"
125+
if [ -n "$SHA256" ] && [ ${#SHA256} -eq 64 ]; then
126+
BIN_URL="https://github.com/${REPO}/releases/download/${TAG}/network_adapter_${TARGET}.bin"
122127
123128
# Add to manifest using jq
124129
jq --arg ver "$VERSION" --arg url "$BIN_URL" --arg sha "$SHA256" \
@@ -135,7 +140,11 @@ jobs:
135140
env:
136141
GH_TOKEN: ${{ github.token }}
137142
run: |
138-
gh release upload "v${{ env.ESP_HOSTED_VERSION }}" \
143+
# Create manifest release if it doesn't exist
144+
gh release view manifest --repo "${{ github.repository }}" >/dev/null 2>&1 || \
145+
gh release create manifest --repo "${{ github.repository }}" --title "Firmware Manifests" --notes "JSON manifests listing all firmware versions for each target."
146+
147+
gh release upload manifest \
139148
--repo "${{ github.repository }}" \
140149
--clobber \
141150
${{ matrix.target }}.json

0 commit comments

Comments
 (0)