我正在尝试使用 github api 将 zip 文件上传到 github 存储库。有时在特定分支上传 zip。但一切都失败了。
试试 1
curl -XPOST -H "Authorization:token XYZ" -H "Content-Type:application/octet-stream" --data-binary @myfile.ipa https://uploads.github.com/repos/username/Test/releases /1/assets?name=myfile.ipa
我得到响应
{"message":"Not Found","request_id”:”AAA:BBB:CCCC:DDDD:EEEEEE”,”documentation_url":"https://developer.github.com/v3"}
试试 2
curl -XPOST -H "Authorization:token XYZ" -H "Content-Type:multipart/form-data" --data-binary @myfile.ipa.zip https://api.github.com/repos/username/Test /contents/myfile.ipa.zip?ref=particular_branch_name
回复
{"message":"Error","request_id”:”AAA:BBB:CCCC:DDDD:EEEEEE”,”documentation_url":"https://developer.github.com/v3"}
尝试 3
curl -XPOST -H "Authorization:token XYZ" -H "Content-Type:multipart/form-data" --data-binary @myfile.ipa.zip https://uploads.github.com/repos/username/Test /contents/NEWFOLDER/@myfile.ipa.zip?ref=particular_branch_name
回复
{"message":"Not Found","request_id”:”AAA:BBB:CCCC:DDDD:EEEEEE”,”documentation_url":"https://developer.github.com/v3"}
我在终端测试这个。检查它是否有效。在 Jenkins 的“构建后操作”中将其作为脚本添加到“构建后任务插件”中之前。