fix: add file existence checks before uploading binaries in release workflows
This commit is contained in:
		@@ -107,7 +107,10 @@ jobs:
 | 
			
		||||
          
 | 
			
		||||
          # Upload binaries
 | 
			
		||||
          cd .pio/build/esp32dev
 | 
			
		||||
          for file in filaman_ota.bin filaman_spiffs.bin filaman_full.bin; do
 | 
			
		||||
          
 | 
			
		||||
          # Check if files exist before uploading
 | 
			
		||||
          for file in filaman_spiffs.bin filaman_full.bin; do
 | 
			
		||||
            if [ -f "$file" ]; then
 | 
			
		||||
              echo "Uploading $file..."
 | 
			
		||||
              curl -k -s \
 | 
			
		||||
                -X POST \
 | 
			
		||||
@@ -115,6 +118,9 @@ jobs:
 | 
			
		||||
                -H "Content-Type: application/octet-stream" \
 | 
			
		||||
                --data-binary "@$file" \
 | 
			
		||||
                "${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$file"
 | 
			
		||||
            else
 | 
			
		||||
              echo "Warning: $file not found"
 | 
			
		||||
            fi
 | 
			
		||||
          done
 | 
			
		||||
        else
 | 
			
		||||
          echo "Failed to create release. Response:"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								.github/workflows/providers/github-release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								.github/workflows/providers/github-release.yml
									
									
									
									
										vendored
									
									
								
							@@ -87,7 +87,23 @@ jobs:
 | 
			
		||||
      env:
 | 
			
		||||
        GH_TOKEN: ${{ github.token }}
 | 
			
		||||
      run: |
 | 
			
		||||
        # Check which files exist and create a list for upload
 | 
			
		||||
        cd .pio/build/esp32dev
 | 
			
		||||
        FILES_TO_UPLOAD=""
 | 
			
		||||
        for file in filaman_spiffs.bin filaman_full.bin; do
 | 
			
		||||
          if [ -f "$file" ]; then
 | 
			
		||||
            FILES_TO_UPLOAD="$FILES_TO_UPLOAD .pio/build/esp32dev/$file"
 | 
			
		||||
          else
 | 
			
		||||
            echo "Warning: $file not found"
 | 
			
		||||
          fi
 | 
			
		||||
        done
 | 
			
		||||
        
 | 
			
		||||
        # Create release with available files
 | 
			
		||||
        if [ -n "$FILES_TO_UPLOAD" ]; then
 | 
			
		||||
          gh release create "${{ github.ref_name }}" \
 | 
			
		||||
            --title "Release ${{ steps.get_version.outputs.VERSION }}" \
 | 
			
		||||
            --notes "${{ steps.changelog.outputs.CHANGES }}" \
 | 
			
		||||
          .pio/build/esp32dev/filaman_full.bin
 | 
			
		||||
            $FILES_TO_UPLOAD
 | 
			
		||||
        else
 | 
			
		||||
          echo "Error: No files found to upload"
 | 
			
		||||
          exit 1
 | 
			
		||||
		Reference in New Issue
	
	Block a user