public void TestGitMiscReleaseNotes() { GitReleaseNotes notes = GitReleaseNotes.MiscSinceVersion("C:\\src\\Bam.Net", 1, 4, 4); notes.Summary = "Misc"; OutLineFormat("{0}", ConsoleColor.Cyan, notes.Value); }
public void TestGitReleaseNotes() { GitReleaseNotes notes = GitReleaseNotes.SinceVersion("Bam.Net.CommandLine", "C:\\src\\Bam.Net", 1, 4, 4); notes.Summary = "Put a nice summary here"; OutLineFormat("{0}", ConsoleColor.Cyan, notes.Value); }
private static bool WriteReleaseNotes(string srcRoot, GitReleaseNotes notes, out string projectRoot) { projectRoot = Path.Combine(srcRoot, notes.PackageId); if (Directory.Exists(projectRoot)) { string releaseNotesFile = Path.Combine(projectRoot, "RELEASENOTES"); notes.Value.SafeWriteToFile(releaseNotesFile, true); return(true); } return(false); }
public void UpdateReleaseNotesSince(string gitRepoPath, int major, int minor, int patch) { GitReleaseNotes releaseNotes = GitReleaseNotes.SinceVersion(Id, gitRepoPath, major, minor, patch); if (releaseNotes.CommitCount > 0) { releaseNotes.Summary = $"Version {Version.Value}\r\nUpdates since v{major}.{minor}.{patch}:"; } else { releaseNotes.Summary = $"Version {Version.Value}"; } ReleaseNotes = releaseNotes.Value; }
/// <summary> /// Updates the release notes by reading git commits that are prefixed with the name (Id) of the /// nuget package. /// </summary> /// <param name="gitRepoPath">The git repo path.</param> public void UpdateReleaseNotes(string gitRepoPath) { GitReleaseNotes releaseNotes = GitReleaseNotes.SinceLatestRelease(Id, gitRepoPath, out string latestRelease); if (releaseNotes.CommitCount > 0) { releaseNotes.Summary = $"Version {Version.Value}\r\nUpdates since {latestRelease}:"; } else { releaseNotes.Summary = $"Version {Version.Value}"; } ReleaseNotes = releaseNotes.Value; }
public static void SetBamInfo() { string nuspecRoot = GetNuspecRoot(); string bamInfoPath = (Arguments["baminfo.json"] ?? Prompt("Enter the path to the baminfo.json file")); string versionString = GetVersion(); string srcRoot = GetSourceRoot(); BamInfo info = bamInfoPath.FromJsonFile <BamInfo>(); int sinceMajor = info.MajorVersion; int sinceMinor = info.MinorVersion; int sincePatch = info.PatchVersion; Out("*** baminfo.json ***", ConsoleColor.Cyan); OutLine(info.PropertiesToString(), ConsoleColor.Cyan); OutLine("***", ConsoleColor.Cyan); OutLineFormat("Updating version from {0} to {1}", ConsoleColor.Yellow, info.VersionString, versionString); info.VersionString = versionString; info.ToJsonFile(bamInfoPath); GitReleaseNotes miscReleaseNotes = GitReleaseNotes.MiscSinceVersion(srcRoot, sinceMajor, sinceMinor, sincePatch); miscReleaseNotes.Summary = $"Version {versionString}"; OutLineFormat("Updating release notes:\r\n{0}", ConsoleColor.DarkYellow, info.ReleaseNotes); info.ReleaseNotes = miscReleaseNotes.Value; info.ToJsonFile(bamInfoPath); string rootReleaseNotes = Path.Combine(srcRoot, "RELEASENOTES"); miscReleaseNotes.Value.SafeWriteToFile(rootReleaseNotes, true); DirectoryInfo nuspecRootDir = new DirectoryInfo(nuspecRoot); FileInfo[] nuspecFiles = nuspecRootDir.GetFiles("*.nuspec", SearchOption.AllDirectories); foreach (FileInfo file in nuspecFiles) { NuspecFile nuspecFile = new NuspecFile(file.FullName); nuspecFile.Authors = info.Authors; nuspecFile.Owners = info.Owners; GitReleaseNotes releaseNotes = GitReleaseNotes.SinceVersion(nuspecFile.Id, srcRoot, sinceMajor, sinceMinor, sincePatch); if (!WriteReleaseNotes(srcRoot, releaseNotes, out string projectRoot)) { Warn("Unable to find project directory ({0}) to write release notes", projectRoot); } releaseNotes.Summary = $"Version {versionString}"; nuspecFile.ReleaseNotes = releaseNotes.Value; nuspecFile.Copyright = "Copyright © {0} {1}"._Format(info.Owners, DateTime.UtcNow.Year); nuspecFile.LicenseUrl = info.LicenseUrl; nuspecFile.ProjectUrl = info.ProjectUrl; string buildNumber = !string.IsNullOrEmpty(info.BuildNumber) ? "-{0}"._Format(info.BuildNumber) : ""; string patch = string.Format("{0}{1}", info.PatchVersion.ToString(), buildNumber); nuspecFile.Version.Major = info.MajorVersion.ToString(); nuspecFile.Version.Minor = info.MinorVersion.ToString(); nuspecFile.Version.Patch = patch; List <NugetPackageIdentifier> bamDependencies = new List <NugetPackageIdentifier>(); if (nuspecFile.Dependencies != null) { nuspecFile.Dependencies.Where(npi => npi.Id.StartsWith(typeof(Args).Namespace)).Each(npi => { bamDependencies.Add(new NugetPackageIdentifier(npi.Id, info.VersionString)); }); nuspecFile.Dependencies = bamDependencies.ToArray(); } nuspecFile.Save(); } }