       return
 
     if release?
-      deleteExistingAsset release, (error) ->
+      deleteExistingAssets release, (error) ->
         callback(error, release)
       return
 

      else
        callback(null, release)

uploadAsset = (release, assetName, assetPath, callback) ->
  options =
    uri: release.upload_url.replace(/\{.*$/, "?name=#{assetName}")
    method: 'POST'
    headers: _.extend({
      'Content-Type': 'application/zip'
      'Content-Length': fs.getSizeSync(assetPath)
      }, defaultHeaders)

  assetRequest = request options, (error, response, body='') ->
    if error? or response.statusCode >= 400
      logError('Upload release asset failed', error, body)
      callback(error ? new Error(response.statusCode))
    else
      callback(null, release)

  fs.createReadStream(assetPath).pipe(assetRequest)

publishRelease = (release, callback) ->
  options =

    if error? or response.statusCode isnt 204
      logError('Deleting release failed', error, body)

deleteExistingAssets = (release, assetNames, callback) ->
  [callback, assetNames] = [assetNames, callback] if not callback?

  deleteAsset = (url, callback) ->
    options =
      uri: url
      method: 'DELETE'
      headers: defaultHeaders
    request options, (error, response, body='') ->
