Publishing to GitHub Releases fails sending the request.

thomas.malkewitz's Avatar


27 Mar, 2018 04:20 PM

I'm having a hell of a time figuring out why I cannot publish my .zip file to GitHub releases, I have created the access token, I have given it full repo rights. I am uploading a single zip artifact, which I can see, but when I publish I always get the same error no matter what:

Creating "WinSCP-PowerShell-v5.13.0.19" release for repository "dotps1/WinSCP" tag "WinSCP-PowerShell-v5.13.0.19" commit "d35fa3ade90cb696931958a938b1e9b6b6eada22"...Error creating GitHub release: An error occurred while sending the request.

I'm not sure what I am missing. Here is my appveyor.yml:

  - ps: xcopy .\WinSCP\* .\deploy\ /S | Out-Null
  - ps: Compress-Archive -Path .\deploy\* -DestinationPath .\ -CompressionLevel Optimal
  - ps: Push-AppveyorArtifact -Path .\ -FileName
  - provider: GitHub
    release: WinSCP-PowerShell-v$(APPVEYOR_BUILD_VERSION)
      secure: zNRQZ3Yia8BPJrcmjn5x3a0FkrLWCFSgtwaxKGOnBvIiYv6WbWi/ilXezZJclZyE
    description: '$(APPVEYOR_REPO_COMMIT_MESSAGE)'
    draft: false
    prerelease: false
      branch: master
      appveyor_repo_tag: false

basically I am copy the source files to a deploy folder, because otherwise there is a locked dll. Then I compress that into a folder right in the root, I push that artifact, which works but then it fails to publish, and i'm not real sure how to troubleshoot it.

here is the link to the project:

  1. 1 Posted by Ilya Finkelshte... on 28 Mar, 2018 07:25 AM

    Ilya Finkelshteyn's Avatar

    Can you try the to do about the same what AppVeyor is doing in PowerShell from your local machine:

    $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 "$env:gh_user/$env:gh_repo/releases" -Headers $headers  -Body $body -Method POST

    Will it fail the same way?

  2. 2 Posted by thomas.malkewit... on 28 Mar, 2018 01:14 PM

    thomas.malkewitz's Avatar

    I had to create another token for this I didn't keep the last one, but again, I gave it repo rights, here is the output:

    Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
    At line:20 char:1
    + Invoke-RestMethod -Uri "$env:gh_user/$en ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
    but how does that work with the artifact? I don't see anything in there in regards to the
  3. 3 Posted by thomas.malkewit... on 28 Mar, 2018 02:14 PM

    thomas.malkewitz's Avatar

    if I add this before the invoke-webrequest, it works:
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

    see this stack overflow article:

  4. 4 Posted by thomas.malkewit... on 28 Mar, 2018 02:40 PM

    thomas.malkewitz's Avatar

    so, I got it to work by adding that line to my before_deploy section of the yml. however, now it builds again when the release is published. so its effectively in a build loop. how do I prevent that?

  5. 5 Posted by Ilya Finkelshte... on 28 Mar, 2018 05:20 PM

    Ilya Finkelshteyn's Avatar

    Interesting. Default settings on AppVeyor build worker is all protocols including Tls2 enabled. And this works with GitHub publishing.

    I would recommend to run [Net.ServicePointManager]::SecurityProtocol in different steps of your build to see what step is breaking SSL settings.

    As for build loop, add skip_tags: true to your YAML.

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:27 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac