如何使用Octokit上传Zip文件



如何使用 Octokit.net 上传zip文件?我是新手 Octokit.net 任何人都可以提供代码片段吗?

ocktokit.net 文档相当完整,请仔细阅读文档。

这是文档中的示例:

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);
}

相关内容

  • 没有找到相关文章

最新更新