From bc1ddbcd1652e5f08d15b008f9f4e2567c063e11 Mon Sep 17 00:00:00 2001 From: jiaxiao zhou Date: Mon, 31 Jul 2023 21:13:50 +0000 Subject: [PATCH] fix: add a stat condition check for uploading release binaries This commits adds a check to confirm the existance of files in the release subdirectories before attempting to upload to GitHub release. This change helps avoid unnecessary errors in the case where the release subdirectories are empty Signed-off-by: jiaxiao zhou --- .github/workflows/release.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 39ece3f23..2d9bc0cd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,9 +99,15 @@ jobs: - name: Create release run: | gh release create ${{ github.ref }} --generate-notes --prerelease - for i in release/*/*; do - gh release upload ${RELEASE_NAME} $i - done + # skip upload if there are no files + if stat release/*/* >/dev/null 2>&1; then + for i in release/*/*; do + gh release upload ${RELEASE_NAME} $i + done + else + echo "No files to upload" + exit 0 + fi env: GH_TOKEN: ${{ github.token }} RELEASE_NAME: ${{ needs.generate.outputs.crate }}/${{ needs.generate.outputs.version }}