如何使用Octokit.net上传zip文件?我是Octokit.net的新手,任何人都可以提供代码段吗?
答案 0 :(得分:1)
ocktokit.net文档非常完整,请仔细阅读docs。
这是文档中的示例:
var client = new GitHubClient(new ProductHeaderValue("my-cool-app"));
var basicAuth = new Credentials("username", "password"); // NOTE: not real credentials
client.Credentials = basicAuth;
using(var archiveContents = File.OpenRead("output.zip")) { // TODO: better sample
var assetUpload = new ReleaseAssetUpload()
{
FileName = "my-cool-project-1.0.zip",
ContentType = "application/zip",
RawData = archiveContents
};
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
var asset = await client.Repository.Release.UploadAsset(release, assetUpload);
}