@@ -250,48 +250,51 @@ jobs:
250250 env :
251251 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
252252
253- - name : Download all release artifacts
253+ - name : Download all release artifacts
254254 run : |
255255 TAG="${{ needs.check-tag.outputs.tag_name }}"
256256 COMMIT_SHA=$(git rev-parse "${TAG}^{commit}")
257257 echo "Tag $TAG points to commit: $COMMIT_SHA"
258258
259- # Get the latest successful run ID for each workflow
259+ # Get the latest successful run ID for each unique workflow
260260 WORKFLOW_RUNS=$(gh run list --commit "$COMMIT_SHA" --status success --json workflowName,databaseId,createdAt --jq 'group_by(.workflowName) | map(sort_by(.createdAt) | last) | .[].databaseId')
261261
262262 mkdir -p release-assets
263263
264264 for run_id in $WORKFLOW_RUNS; do
265265 echo "Processing Run ID: $run_id"
266- # Download artifacts, but EXCLUDE anything ending in '-logs'
267- gh run download "$run_id" --dir release-assets --exclude "*-logs" 2>/dev/null || true
266+ gh run download "$run_id" --dir release-assets 2>/dev/null || true
268267 done
269268
270- # Package folders into zips
271269 cd release-assets
270+
271+ # Clean up: Delete any folders ending in "-logs" BEFORE we start zipping
272+ echo "Cleaning up log artifacts..."
273+ rm -rf *-logs/
274+
275+ # Package remaining folders into zips
272276 for dir in */; do
277+ # Ensure we are actually looking at a directory
273278 [ -d "$dir" ] || continue
274279 dir_name="${dir%/}"
275280
276- # Safety check: skip if the directory name ends in -logs (if the exclude above missed it)
277- if [[ "$dir_name" == *"-logs" ]]; then
278- echo "Skipping log directory: $dir_name"
279- rm -rf "$dir"
280- continue
281- fi
281+ echo "Processing folder: $dir_name"
282282
283- # Check for existing zip inside
283+ # Check for existing zip inside (e.g. if firmware was already zipped)
284284 INNER_ZIP=$(find "$dir" -maxdepth 1 -name "*.zip" | head -n 1)
285285
286286 if [ -n "$INNER_ZIP" ]; then
287- echo "Found existing zip in $dir_name, moving it..."
287+ echo " Found existing zip, pulling it out ..."
288288 mv "$INNER_ZIP" "${dir_name}.zip"
289289 else
290- echo "No zip found in $ dir_name, zipping contents ..."
290+ echo " No zip found, creating ${ dir_name}.zip ..."
291291 (cd "$dir" && zip -r "../${dir_name}.zip" .)
292292 fi
293+
294+ # Remove the folder after zipping/moving
293295 rm -rf "$dir"
294296 done
297+
295298 env :
296299 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
297300
0 commit comments