/// <summary> /// Creates a new GitHub release. /// </summary> /// <param name="newRelease">The new release.</param> /// <param name="cancellationToken"> /// An optional token to monitor for cancellation requests. /// </param> /// <returns>The created release.</returns> public async Task <Release> CreateReleaseAsync( NewRelease newRelease, CancellationToken cancellationToken = default) { var octokitRelease = await _gitHubApi .CreateReleaseAsync(newRelease.OctokitNewRelease) .ConfigureAwait(false); var release = new Release(octokitRelease); foreach (var asset in newRelease.Assets) { cancellationToken.ThrowIfCancellationRequested(); var octokitAsset = await _gitHubApi.UploadAssetAsync(octokitRelease, asset) .ConfigureAwait(false); release.AddAsset(new ReleaseAsset(octokitAsset)); } return(release); }