public ReleaseNotesExporter(IVcsProvider vcsProvider, Config configuration, string user, string repository) { _vcsProvider = vcsProvider; _configuration = configuration; _user = user; _repository = repository; }
private static async Task <int> CreateReleaseAsync(CreateSubOptions subOptions) { Log.Information("Creating release..."); _vcsProvider = GetVcsProvider(subOptions); Core.Model.Release release; if (!string.IsNullOrEmpty(subOptions.Milestone)) { Log.Verbose("Milestone {Milestone} was specified", subOptions.Milestone); var releaseName = subOptions.Name; if (string.IsNullOrWhiteSpace(releaseName)) { Log.Verbose("No Release Name was specified, using {Milestone}.", subOptions.Milestone); releaseName = subOptions.Milestone; } release = await _vcsProvider.CreateReleaseFromMilestone(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.Milestone, releaseName, subOptions.TargetCommitish, subOptions.AssetPaths, subOptions.Prerelease).ConfigureAwait(false); } else { Log.Verbose("No milestone was specified, switching to release creating from input file"); release = await _vcsProvider.CreateReleaseFromInputFile(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.Name, subOptions.InputFilePath, subOptions.TargetCommitish, subOptions.AssetPaths, subOptions.Prerelease).ConfigureAwait(false); } Log.Information("Drafted release is available at:\n{HtmlUrl}", release.HtmlUrl); Log.Verbose("Body:\n{Body}", release.Body); return(0); }
public ReleaseNotesBuilder(IVcsProvider vcsProvider, string user, string repository, string milestoneTitle, Config configuration) { _vcsProvider = vcsProvider; _user = user; _repository = repository; _milestoneTitle = milestoneTitle; _configuration = configuration; }
private static async Task <int> PublishReleaseAsync(PublishSubOptions subOptions) { _vcsProvider = GetVcsProvider(subOptions); await _vcsProvider.PublishRelease(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.TagName).ConfigureAwait(false); return(0); }
private static async Task <int> CreateLabelsAsync(LabelSubOptions subOptions) { Log.Information("Creating standard labels"); _vcsProvider = GetVcsProvider(subOptions); await _vcsProvider.CreateLabels(subOptions.RepositoryOwner, subOptions.RepositoryName).ConfigureAwait(false); return(0); }
private static async Task <int> OpenMilestoneAsync(OpenSubOptions subOptions) { Log.Information("Opening milestone {Milestone}", subOptions.Milestone); _vcsProvider = GetVcsProvider(subOptions); await _vcsProvider.OpenMilestone(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.Milestone).ConfigureAwait(false); return(0); }
private static async Task <int> AddAssetsAsync(AddAssetSubOptions subOptions) { Log.Information("Uploading assets"); _vcsProvider = GetVcsProvider(subOptions); await _vcsProvider.AddAssets(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.TagName, subOptions.AssetPaths).ConfigureAwait(false); return(0); }
private static async Task <int> DiscardReleaseAsync(DiscardSubOptions subOptions) { Log.Information("Discarding release {Milestone}", subOptions.Milestone); _vcsProvider = GetVcsProvider(subOptions); await _vcsProvider.DiscardRelease(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.Milestone); return(0); }
private static async Task <int> ExportReleasesAsync(ExportSubOptions subOptions) { Log.Information("Exporting release {TagName}", subOptions.TagName); _vcsProvider = GetVcsProvider(subOptions); var releasesMarkdown = await _vcsProvider.ExportReleases(subOptions.RepositoryOwner, subOptions.RepositoryName, subOptions.TagName).ConfigureAwait(false); using (var sw = new StreamWriter(File.Open(subOptions.FileOutputPath, FileMode.OpenOrCreate))) { sw.Write(releasesMarkdown); } return(0); }
/// <summary> /// Searches all VCS providers implemented in the current assembly and creates an instance /// of each type. /// </summary> /// <returns>An array containing all created VCS provider instances.</returns> private static IVcsProvider[] GetVcsProviders() { List <IVcsProvider> providers = new List <IVcsProvider>(); foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) { if (!type.IsInterface && typeof(IVcsProvider).IsAssignableFrom(type)) { IVcsProvider provider = (IVcsProvider)Activator.CreateInstance(type); providers.Add(provider); } } return(providers.ToArray()); }