@@ -706,15 +706,36 @@ jobs:
706706 GH_TOKEN : ${{ github.token }}
707707 run : |
708708 ls
709- find tmp -type f \( -name "*.zip" -o -name "*.whl" -o -name "*.tar.gz" -o -name "*.nupkg" -o -name "*.snupkg" \) > release_files.txt
709+ find tmp -type f \( -name "*.zip" -o -name "*.whl" -o -name "*.tar.gz" -o -name "*.nupkg" -o -name "*.snupkg" \) -print0 > release_files.txt
710710
711- gh release create Nightly \
712- --title "Nightly" \
713- --notes "Automated nightly build from commit ${{ github.sha }}" \
714- --prerelease \
715- --target ${{ github.sha }} \
716- --clobber \
717- $(cat release_files.txt | tr '\n' ' ')
711+ # Deduplicate files - keep only first occurrence of each basename
712+ # Use NUL-delimited input/output to handle spaces in filenames safely
713+ declare -A seen_basenames
714+ declare -a unique_files
715+
716+ while IFS= read -r -d $'\0' filepath || [ -n "$filepath" ]; do
717+ [ -z "$filepath" ] && continue
718+ basename="${filepath##*/}"
719+
720+ # Keep only first occurrence of each basename
721+ if [ -z "${seen_basenames[$basename]}" ]; then
722+ seen_basenames[$basename]=1
723+ unique_files+=("$filepath")
724+ fi
725+ done < release_files.txt
726+
727+ # Create release with properly quoted file arguments
728+ if [ ${#unique_files[@]} -gt 0 ]; then
729+ gh release create Nightly \
730+ --title "Nightly" \
731+ --notes "Automated nightly build from commit ${{ github.sha }}" \
732+ --prerelease \
733+ --target ${{ github.sha }} \
734+ "${unique_files[@]}"
735+ else
736+ echo "No files to release after deduplication"
737+ exit 1
738+ fi
718739
719740
720741 publish-test-pypi :
0 commit comments