简体   繁体   English

如何使用 REST API 将文件提交到 github 以进行 CI 集成

[英]How to commit file to github using REST API for CI integration

I want to send my.apk file to the github repository through REST API.我想通过 REST API 将 my.apk 文件发送到 github 存储库。

File is converting to base64 and send as blob:文件正在转换为 base64 并作为 blob 发送:

BLOB_SHA=$(curl -X POST  https://api.github.com/repos/{user}/{repo}/git/blobs -H "Accept: application/vnd.github.v3.raw+json" -H "Authorization: Basic {token}" -d '{"content":{my app in base64},"encoding":"utf-8|base64"}' | jq '.sha')

But here is a message:但这里有一条消息:

bash: /mingw64/bin/curl: Argument list too long

What I try to achive is: build apk on Codemagic, send apk to github, trigger appium test automation.我试图实现的是:在 Codemagic 上构建 apk,将 apk 发送到 github,触发 appium 测试自动化。

Maybe there is any other posibility to connect Codemagic build and appium tests?也许还有其他连接 Codemagic 构建和 appium 测试的可能性?

probably it will be better to run Appium tests with Codemagic after you built an apk.在构建 apk 之后,使用 Codemagic 运行 Appium 测试可能会更好。 In this case you don't need to commit any binaries back to the repository.在这种情况下,您不需要将任何二进制文件提交回存储库。 Check this link to see example how to run Appium tests https://docs.codemagic.io/yaml-testing/testing/#react-native-integration-tests-using-appium-and-emulator检查此链接以查看如何运行 Appium 测试的示例 https://docs.codemagic.io/yaml-testing/testing/#react-native-integration-tests-using-appium-and-emulator

However if you still want to commit file you can just use git commands but ensure you have write permissions (check this link for example https://docs.codemagic.io/knowledge-base/add-a-git-tag-with-app-version/ )但是,如果您仍然想提交文件,您可以只使用git命令,但请确保您具有写入权限(例如查看此链接https://docs.codemagic.io/knowledge-base/add-a-git-tag-with-应用程序版本/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM