private static void WriteJekyllRelease(Options options, Version newVersion) { var dateTime = DateTime.Now.ToString("yyyy-MM-dd"); string text = String.Format(MarkdownTemplate, newVersion.ToString(3), dateTime); var format = string.Format("{0}-v{1}.markdown", dateTime, newVersion.ToString(3)); File.WriteAllText(Path.Combine(options.LocalRepo, "_posts", format), text); }
private static Version SetPackageVersion(Options options, Manifest m) { Version v2; if (options.Version != null) { if (options.Version.StartsWith("+")) { Version v = Version.Parse(m.Metadata.Version); Version vinc = Version.Parse(options.Version.Substring(1)); v2 = new Version(v.Major + vinc.Major, v.Minor + vinc.Minor, v.Build + vinc.Build, 0); } else { v2 = Version.Parse(options.Version); } } else { Assembly asm = FindAssembly(options, m); v2 = asm.GetName().Version; } m.Metadata.Version = v2.ToString(); using (FileStream fileStream = File.Open(options.NuSpec, FileMode.Truncate)) m.Save(fileStream, true); return v2; }
private static object PushReleasesToGithub(Options options, Version newVersion) { using (Repository repo = new Repository(options.LocalRepo)) { RepositoryStatus st = repo.RetrieveStatus(); List<string> toCommit = st.Untracked.Concat(st.Modified).Select(x => x.FilePath).Where(f => f.Contains("Releases")).ToList(); if (toCommit.Any()) { repo.Stage(toCommit); RepositoryStatus st2 = repo.RetrieveStatus(); Commit commit = repo.Commit("Release v." + newVersion); } } bool pushed = RunProcess("git", "push origin master", options.LocalRepo); return null; }
private static Assembly FindAssembly(Options options, Manifest manifest) { string id = manifest.Metadata.Id; ManifestFile asmf = manifest.Files.FirstOrDefault(f => Path.GetFileName(f.Source) == id + ".exe"); if (asmf == null) return null; string fullPath = Path.Combine(Path.GetDirectoryName(options.NuSpec), asmf.Source); return Assembly.ReflectionOnlyLoadFrom(fullPath); }
private static string CreateSquirrelRelease(Options options, string nupkg) { bool p = RunProcess(options.SquirrelCom, string.Format("--releasify \"{0}\" --releaseDir=\"{1}\"", nupkg, options.ReleaseDir)); return null; }
private static string CreatePackage(Options options, Manifest m) { string expectedPackage = string.Format("{0}.{1}.nupkg", m.Metadata.Id, m.Metadata.Version); TryDelete(expectedPackage); bool p = RunProcess(options.NugetExe, string.Format("pack \"{0}\"", options.NuSpec)); return p && File.Exists(expectedPackage) ? expectedPackage : null; //.nuget\NuGet.exe pack NewOrder\NewOrder.nuspec }