The answer to the question. It was very difficult to find a good way to search for an identifier, but now it works !: D
How to automatically release your artifact on GitHub
First, create a tag on your CI server after creating the artifact.
git tag :yourversion
Click the tag on GitHub (I use a token to avoid username and password)
git push https://your_token:@github.com/you/yourrepo.git --tags
Now create the cURL release. I use a lot of variables, so I want to use echo to write variables, and then click using json file
echo Creating release... echo {"tag_name": "%PLATFORM%_%APPVEYOR_BUILD_VERSION%","target_commitish": "%APPVEYOR_REPO_BRANCH%","name": "2spark v%APPVEYOR_BUILD_VERSION% for %PLATFORM% devices","body": "Release of 2spark app v%APPVEYOR_BUILD_VERSION%\n Commit by %APPVEYOR_REPO_COMMIT_AUTHOR% \n%APPVEYOR_REPO_COMMIT_MESSAGE%","draft": false,"prerelease": true} > json.json curl -# -XPOST -H 'Content-Type:application/json' -H 'Accept:application/json' --data-binary @json.json https://api.github.com/repos/you/yourrepo/releases?access_token=your_token -o response.json del json.json
There is your identifier on response.json. To find it, I use this .bat file http://www.dostips.com/forum/viewtopic.php?f=3&t=4697 and then some variables. YOU SHOULD COPY ALL CODE TO GET THIS WORK!
echo Search the release id... type response.json | findrepl id | findrepl /O:1:1 >> raw_id.txt del response.json echo Refining the id... set /p raw_id_release=<raw_id.txt set raw_id_release2=%raw_id_release:*"id": =% set id_release=%raw_id_release2:,=% echo The ID is %id_release% , yay! del raw_id.txt
Finally, post your artifact as a body message
echo Uploading artifact to Github... curl -# -XPOST -H "Authorization:token your_token" -H "Content-Type:application/octet-stream" --data-binary @yourbinary.exe https:
Enjoy your release!
source share