I came across the following challenge: Automate the upload of several build artefacts to the BitBucket cloud service downloads section.
You might ask yourself “why is this a challenge“, and the answer was a little shock for me: “cause it is something that might get very complicated with Windows PowerShell 5“.
I did some test on my Mac and I find it very easy with curl.
curl -X POST "https://MyUsername:[email protected]/2.0/repositories/dummyTeam/myproject/downloads" --form files=@"/home/dev/release\myproject-current.zip"
But curl is not available an my build server. So I tried to get it working with Invoke-RestMethod or Invoke-WebRequest. I ended up very frustrated! Searched around and found a lot of people that seem to have the same problem, but none of the answers seemed to work, at least not for me. Maybe an issue of the BitBucket cloud API, but I think it is more a general issue of Windows PowerShell.