Creé un file por lotes para hacer las versiones de Github desde mi server de CI en AppVeyor. Todo funciona bien, excepto cuando bash upload mi activo a Github. Mis habilidades no me ayudan mucho. ¿Hay algún método para get mi id de publicación de los commands de cURL para usarlo en la URL de carga de activos? Muchas gracias 🙂
EDITAR: uso 3 files por lotes:
AppveyorBuildReleases.bat
git tag %PLATFORM%_%APPVEYOR_BUILD_VERSION% git push https://token_here:@github.com/2spark/SparklrWP.git --tags 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/2spark/SparklrWP/releases?access_token=token_here del json.json move c:\projects\SparklrWP\SparklrForWindowsPhone\SparklrForWindowsPhone\Bin\%PLATFORM%\%CONFIGURATION%\SparklrForWindowsPhone_%CONFIGURATION%_%PLATFORM%.xap c:\projects\SparklrWP rename c:\projects\SparklrWP\SparklrForWindowsPhone_%CONFIGURATION%_%PLATFORM%.xap SparklrForWindowsPhone.xap file_size.bat "c:\projects\SparklrWP\SparklrForWindowsPhone.xap"
file_size.bat
set size=%~z1 AppVeyorBuildReleases2.bat
AppVeyorBuildReleases2.bat
curl -XPOST -H "Authorization:token token_here" -H "Content-Type:application/octet-stream" -H "Content-Length:%size%" --data-binary @SparklrForWindowsPhone.xap https://uploads.github.com/repos/2spark/SparklrWP/releases/TheIDgoesHERE/assets?name=SparklrForWindowsPhone.xap EXIT
Pero no sé cómo encontrar la identificación. ¿Puedes ayudarme por favor? 🙂
Pregunta auto-respondida Fue realmente difícil encontrar una buena forma de search la identificación, ¡pero ahora está funcionando! :RE
Primero, en su server CI, después de comstackr el artefacto, cree una label.
git tag :yourversion
Empuje su label a GitHub (utilizo un token para evitar el nombre de usuario y la contraseña)
git push https://your_token:@github.com/you/yourrepo.git --tags
Ahora crea una versión con cURL. Uso muchas variables, entonces quiero usar echo
para escribir las variables y luego presiono con un file json
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
En response.json está tu identificación. Para encontrarlo, utilizo este file .bat http://www.dostips.com/forum/viewtopic.php?f=3&t=4697 y luego algunas variables. ¡USTED DEBE COPIAR TODO EL CÓDIGO PARA OBTENER ESTE FUNCIONAMIENTO!
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
Finalmente, publica tu artefacto como post corporal
echo Uploading artifact to Github... curl -# -XPOST -H "Authorization:token your_token" -H "Content-Type:application/octet-stream" --data-binary @yourbinary.exe https://uploads.github.com/repos/you/yourrepo/releases/%id_release%/assets?name=yourbinary.exe echo Done. Enjoy your release :) EXIT
Disfruta tu lanzamiento!