[英]Upload build artifact to Github as release in Jenkins
我正在寻找一种方法来将构建工件上传为Jenkins中的Github Release作为构建后操作或发布者 - 类似于Publish Over 。
Jenkins的Github插件( JENKINS-18598 )尚未支持此功能。
我一直在研究postbuild-task插件,但这似乎不支持环境变量(我认为这有助于防止在构建输出中记录我的API令牌)。
有没有人这样做过呢? 用Jenkins解决这个问题的好方法是什么? 通过cURL或CLI客户端上传(例如基于Go的github-release )。
我通过使用github-release工具解决了它。 像魅力一样非常容易。
echo "Compressing artifacts into one file"
zip -r artifacts.zip artifacts_folder
echo "Exporting token and enterprise api to enable github-release tool"
export GITHUB_TOKEN=$$$$$$$$$$$$
export GITHUB_API=https://git.{your domain}.com/api/v3 # needed only for enterprise
echo "Deleting release from github before creating new one"
github-release delete --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${VERSION_NAME}
echo "Creating a new release in github"
github-release release --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${VERSION_NAME} --name "${VERSION_NAME}"
echo "Uploading the artifacts into github"
github-release upload --user ${GITHUB_ORGANIZATION} --repo ${GITHUB_REPO} --tag ${VERSION_NAME} --name "${PROJECT_NAME}-${VERSION_NAME}.zip" --file artifacts.zip
我认为你正在走上正轨!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.