tag:help.appveyor.com,2012-11-13:/discussions/questions/18741-publishing-to-github-releases-fails-sending-the-requestAppVeyor: Discussion 2018-08-25T02:27:58Ztag:help.appveyor.com,2012-11-13:Comment/449841172018-03-28T07:25:51Z2018-03-28T07:25:51ZPublishing to GitHub Releases fails sending the request.<div><p>Can you try the to do about the same what AppVeyor is doing in PowerShell from your local machine:</p>
<pre>
<code>$token = '<your_token>'
$env:gh_user = "dotps1"
$env:gh_repo = "WinSCP"
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$body = @{
tag_name = "WinSCP-PowerShell-v5.13.0.19"
target_commitish = "d35fa3ade90cb696931958a938b1e9b6b6eada22"
name = "WinSCP-PowerShell-v5.13.0.19"
draft = $true
prerelease = $false
body = "Build - testing publishing to github releases."
}
$body = $body | ConvertTo-Json
Invoke-RestMethod -Uri "https://api.github.com/repos/$env:gh_user/$env:gh_repo/releases" -Headers $headers -Body $body -Method POST</code>
</pre>
<p>Will it fail the same way?</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/449841172018-03-28T13:14:53Z2018-03-28T13:14:53ZPublishing to GitHub Releases fails sending the request.<div><p>I had to create another token for this I didn't keep the last one, but again, I gave it <code>repo</code> rights, here is the output:<br></p>
<pre>
<code>Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
At line:20 char:1
+ Invoke-RestMethod -Uri "https://api.github.com/repos/$env:gh_user/$en ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand</code>
</pre>
but how does that work with the artifact? I don't see anything in there in regards to the <code>WinSCP.zip</code>.</div>thomas.malkewitztag:help.appveyor.com,2012-11-13:Comment/449841172018-03-28T14:14:45Z2018-03-28T14:15:06ZPublishing to GitHub Releases fails sending the request.<div><p>if I add this before the <code>invoke-webrequest</code>, it works:<br>
<code>[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12</code></p>
<p>see this stack overflow article:<br>
<a href="https://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel">https://stackoverflow.com/questions/41618766/powershell-invoke-webr...</a></p></div>thomas.malkewitztag:help.appveyor.com,2012-11-13:Comment/449841172018-03-28T14:40:18Z2018-03-28T14:40:46ZPublishing to GitHub Releases fails sending the request.<div><p>so, I got it to work by adding that line to my <code>before_deploy</code> section of the yml. however, now it builds again when the release is published. so its effectively in a <em>build loop</em>. how do I prevent that?</p>
<p><a href="https://github.com/dotps1/WinSCP/blob/f2dc9dcc5ff06392659ef570fbb646e0e06fb1a7/appveyor.yml#L27">https://github.com/dotps1/WinSCP/blob/f2dc9dcc5ff06392659ef570fbb64...</a></p></div>thomas.malkewitztag:help.appveyor.com,2012-11-13:Comment/449841172018-03-28T17:20:40Z2018-03-28T17:20:40ZPublishing to GitHub Releases fails sending the request.<div><p>Interesting. Default settings on AppVeyor build worker is all protocols including <code>Tls2</code> enabled. And this works with GitHub publishing.</p>
<p>I would recommend to run <code>[Net.ServicePointManager]::SecurityProtocol</code> in different steps of your build to see what step is breaking SSL settings.</p>
<p>As for <em>build loop</em>, add <code>skip_tags: true</code> to your YAML.</p></div>Ilya Finkelshteyn