コード例 #1
0
ファイル: GitHubWrapper.cs プロジェクト: pmiossec/Buildcs
		public bool Release(string repository, string oauthToken, string tagName, UploadFile[] files, string releaseNotesFile = null)
		{
			_repository = repository;
			_oauthToken = oauthToken;
			_tagName = tagName;
			_releaseNotesFile = releaseNotesFile;

			var client = new GitHubClient(new Octokit.ProductHeaderValue("GitTfsTasks"), CredentialStore).Release;
			var release = client.CreateRelease(Owner, RepositoryName, BuildReleaseData()).Result;
			IdRelease = release.Id;
			//BuildHelper.DisplayAndLog(string.Format("Created Release {0} at {1}", release.TagName, release.HtmlUrl));
			if (files != null && files.Length != 0)
			{
				UploadedAssets = UploadAll(client, release, files);
				//foreach (var item in UploadedAssets) BuildHelper.DisplayAndLog(string.Format("Uploaded {0}", item));
			}

			return true;
		}
コード例 #2
0
ファイル: GitHubWrapper.cs プロジェクト: pmiossec/Buildcs
		private ReleaseAssetUpload BuildAssetUpload(UploadFile item)
		{
			return new ReleaseAssetUpload
				{
					ContentType = item.ContentType ?? "application/octet-stream",
					FileName = Path.GetFileName(item.Path),
					RawData = File.OpenRead(item.Path)
				};
		}
コード例 #3
0
ファイル: GitHubWrapper.cs プロジェクト: pmiossec/Buildcs
		private string Upload(IReleasesClient client, Release release, UploadFile sourceItem)
		{
			var uploadedAsset = client.UploadAsset(release, BuildAssetUpload(sourceItem));
			return TaskItemFor(release, uploadedAsset);
		}