private async Task CreateProjectPackage(string version, CancellationToken token) { var projectPath = Path.Combine(Context.ContentDirectory, "Jenkins.Net.Publishing"); var packageDefFile = Path.Combine(projectPath, "Jenkins.Net.Publishing.json"); var output = Path.Combine(Context.ContentDirectory, "PublishPackage", "Jenkins.Net.zip"); try { Context.WriteTagLine("Creating project package...", ConsoleColor.White); var packageDef = ProjectPackageTools.LoadDefinition(packageDefFile); await ProjectPackageTools.CreatePackage( definition : packageDef, rootPath : projectPath, version : version, outputFilename : output); Context.WriteTagLine("Created project package successfully.", ConsoleColor.White); } catch (Exception error) { Context.WriteErrorBlock("Failed to create project package!", error.UnfoldMessages()); throw; } try { Context.WriteTagLine("Publishing project package...", ConsoleColor.White); await Context.Packages.PushProjectPackageAsync(output, token); Context.WriteTagLine("Published project package successfully.", ConsoleColor.White); } catch (Exception error) { Context.WriteErrorBlock("Failed to publish project package!", error.UnfoldMessages()); throw; } }
public async Task Run() { var rootPath = Path.GetDirectoryName(MetadataFilename); var metadata = ProjectPackageTools.LoadDefinition(MetadataFilename); await ProjectPackageTools.CreatePackage(metadata, rootPath, PackageVersion, PackageFilename); }
public async Task Run() { await ProjectPackageTools.CreatePackage(MetadataFilename, PackageVersion, PackageFilename); }