public async Task RunAsync(CancellationToken token) { var photonVars = Context.ServerVariables["photon"]; if (photonVars == null) { throw new ApplicationException("Photon Variables were not found!"); } nugetPackageDir = Path.Combine(Context.WorkDirectory, "Packages"); var nugetApiKey = Context.ServerVariables["global"]["nuget/apiKey"]; apiUrl = photonVars["apiUrl"]; ftpUrl = photonVars["ftp/url"]; ftpUser = photonVars["ftp/user"]; ftpPass = photonVars["ftp/pass"]; msbuild = new MSBuildCommand(Context) { Exe = Context.AgentVariables["global"]["msbuild_exe"], WorkingDirectory = Context.ContentDirectory, }; await BuildSolution(token); nugetCore = new NuGetCore(Context) { ApiKey = nugetApiKey, }; nugetCore.Initialize(); nugetCmd = new NuGetCommand(Context) { Exe = Path.Combine(Context.ContentDirectory, "bin", "NuGet.exe"), //Context.AgentVariables["global"]["nuget_exe"]; WorkingDirectory = Context.ContentDirectory, }; await Task.WhenAll( PublishServer(token), PublishAgent(token), PublishCLI(token)); PathEx.CreatePath(nugetPackageDir); var projectPath = Path.Combine(Context.ContentDirectory, "Photon.Framework"); var assemblyFilename = Path.Combine(projectPath, "bin", "Release", "Photon.Framework.dll"); frameworkVersion = AssemblyTools.GetVersion(assemblyFilename); await PublishFrameworkPackage(token); await PublishPluginPackage("Photon.MSBuild", token); await PublishPluginPackage("Photon.WindowsServices", token); await PublishPluginPackage("Photon.Config", token); await PublishPluginPackage("Photon.NuGet", token); await PublishPluginPackage("Photon.NuGet.Core", token); await PublishPluginPackage("Photon.IIS", token); await PublishPluginPackage("Photon.NUnit", token); await PublishPluginPackage("Photon.DotNet", token); }
private async Task PublishProjectPackage(CancellationToken token) { var projectPath = Path.Combine(Context.ContentDirectory, "PiServerLite"); var packageDefinition = Path.Combine(projectPath, "PiServerLite.csproj"); var assemblyFilename = Path.Combine(projectPath, "bin", "Release", "PiServerLite.dll"); var assemblyVersion = AssemblyTools.GetVersion(assemblyFilename); await PublishPackage("PiServerLite", packageDefinition, assemblyVersion, token); }
private async Task PublishPluginPackage(string id, CancellationToken token) { var projectPath = Path.Combine(Context.ContentDirectory, "Plugins", id); var packageDefinition = Path.Combine(projectPath, $"{id}.csproj"); var assemblyFilename = Path.Combine(projectPath, "bin", "Release", $"{id}.dll"); var assemblyVersion = AssemblyTools.GetVersion(assemblyFilename); await PublishPackage(id, packageDefinition, assemblyVersion, token); }
public async Task RunAsync(CancellationToken token) { await BuildTools.BuildSolution(Context, token); await TestTools.UnitTest(Context, token); var assemblyFile = Path.Combine(Context.ContentDirectory, "Jenkins.Net", "bin", "Release", "net45", "Jenkins.Net.dll"); var assemblyVersion = AssemblyTools.GetVersion(assemblyFile); var projectPackageVersion = $"{Context.BuildNumber}.{assemblyVersion}"; await CreateNugetPackage(token); await CreateProjectPackage(projectPackageVersion, token); }
public async Task RunAsync(CancellationToken token) { var photonVars = Context.ServerVariables["photon"]; if (photonVars == null) { throw new ApplicationException("Photon Variables were not found!"); } nugetPackageDir = Path.Combine(Context.WorkDirectory, "Packages"); nugetApiKey = Context.ServerVariables["global"]["nuget.apiKey"]; nugetExe = Context.AgentVariables["global"]["nuget.exe"]; apiUrl = photonVars["apiUrl"]; ftpUrl = photonVars["ftp.url"]; ftpUser = photonVars["ftp.user"]; ftpPass = photonVars["ftp.pass"]; await BuildSolution(); await Task.WhenAll( PublishServer(token), PublishAgent(token), PublishCLI(token)); PathEx.CreatePath(nugetPackageDir); var projectPath = Path.Combine(Context.ContentDirectory, "Photon.Framework"); var assemblyFilename = Path.Combine(projectPath, "bin", "Release", "Photon.Framework.dll"); frameworkVersion = AssemblyTools.GetVersion(assemblyFilename); await PublishFrameworkPackage(token); await PublishPluginPackage("Photon.IIS", token); await PublishPluginPackage("Photon.NuGet", token); await PublishPluginPackage("Photon.WindowsServices", token); await PublishPluginPackage("Photon.Config", token); }
private async Task PublishPackage(CancellationToken token) { var assemblyFilename = Path.Combine(Context.ContentDirectory, "Jenkins.NET", "bin", "Release", "Jenkins.NET.dll"); var version = AssemblyTools.GetVersion(assemblyFilename); var apiKey = Context.ServerVariables["global"]["nuget.apiKey"]; var nugetTool = new NuGetPackagePublisher(Context) { Mode = NugetModes.Hybrid, Client = new NuGetCore { EnableV3 = true, Output = Context.Output, ApiKey = apiKey, }, CL = new NuGetCommandLine { ExeFilename = Path.Combine(Context.ContentDirectory, "bin", "NuGet.exe"), Output = Context.Output, }, PackageId = "jenkinsnet", PackageDefinition = Path.Combine(Context.ContentDirectory, "Jenkins.NET", "Jenkins.NET.csproj"), PackageDirectory = Path.Combine(Context.WorkDirectory, "Packages"), //Configuration = "Release", //Platform = "AnyCPU", Version = version, PackProperties = { ["configuration"] = "Release", ["platform"] = "AnyCPU", }, }; nugetTool.Client.Initialize(); await nugetTool.PublishAsync(token); }
public async Task PublishAsync(string packageName, string packageId, CancellationToken token = default(CancellationToken)) { context.Output.WriteBlock() .Write("Updating Application ", ConsoleColor.DarkCyan) .Write(packageName, ConsoleColor.Cyan) .WriteLine("...", ConsoleColor.DarkCyan) .Post(); var photonVars = context.ServerVariables["photon"]; if (photonVars == null) { throw new ApplicationException("Photon Variables were not found!"); } var assemblyVersion = AssemblyTools.GetVersion(AssemblyFilename); var webVersion = await GetWebVersion(); if (!VersionTools.HasUpdates(webVersion, assemblyVersion)) { context.Output.WriteBlock() .Write("Application ", ConsoleColor.DarkBlue) .Write(packageName, ConsoleColor.Blue) .Write(" is up-to-date. Version ", ConsoleColor.DarkBlue) .WriteLine(assemblyVersion, ConsoleColor.Blue) .Post(); return; } // Publish // Create ZIP PathEx.CreatePath(PackagePath); var zipFilename = Path.Combine(PackagePath, $"{packageId}.zip"); await CreateZip(BinPath, zipFilename); // Create Version Directory try { await CreateWebPath(assemblyVersion, token); } catch (WebException) { //... } var webMsiName = $"{packageId}.{assemblyVersion}.msi"; var webZipName = $"{packageId}.{assemblyVersion}.zip"; var msiWebUrl = NetPath.Combine(UploadPath, assemblyVersion, webMsiName); var zipWebUrl = NetPath.Combine(UploadPath, assemblyVersion, webZipName); await UploadFile(MsiFilename, msiWebUrl, token); await UploadFile(zipFilename, zipWebUrl, token); var index = new { version = assemblyVersion, msiFilename = webMsiName, zipFilename = webZipName, notes = "...", }; await UploadIndex(index, assemblyVersion, token); await UpdateLatest(assemblyVersion, token); context.Output.WriteBlock() .Write("Application ", ConsoleColor.DarkGreen) .Write(packageName, ConsoleColor.Green) .Write(" updated successfully. ", ConsoleColor.DarkGreen) .Write("Version ", ConsoleColor.DarkCyan) .WriteLine(assemblyVersion, ConsoleColor.Cyan) .Post(); }