Skip to content

Commit 29516fb

Browse files
author
JoshuaMiller
committed
package path fix
1 parent df1b95a commit 29516fb

2 files changed

Lines changed: 38 additions & 10 deletions

File tree

Jenkins.Net.Publishing/Scripts/Package.cs

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.IO;
88
using System.Threading;
99
using System.Threading.Tasks;
10+
using Photon.Framework.Extensions;
1011

1112
namespace Jenkins.NET.Publishing.Scripts
1213
{
@@ -17,7 +18,7 @@ public class Package : IBuildTask
1718

1819
public async Task RunAsync(CancellationToken token)
1920
{
20-
var packageDir = Path.Combine(Context.WorkDirectory, "Packages");
21+
var packageDir = Path.Combine(Context.ContentDirectory, "PublishPackages");
2122

2223
await BuildTools.BuildSolution(Context, token);
2324
await TestTools.UnitTest(Context, token);
@@ -38,22 +39,46 @@ private async Task CreateProjectPackage(CancellationToken token)
3839
Script = "Publish",
3940
Files = {
4041
new PackageFileDefinition {
41-
Path = "Packages",
42+
Path = "Jenkins.Net.Publishing\\bin\\Debug\\**",
4243
Destination = "",
44+
},
45+
new PackageFileDefinition {
46+
Path = "PublishPackages",
47+
Destination = "PublishPackages",
4348
}
4449
}
4550
};
4651

4752
var version = Context.BuildNumber.ToString();
48-
var output = Path.Combine(Context.BinDirectory, "Jenkins.Net.zip");
53+
var output = Path.Combine(Context.ContentDirectory, "PublishPackages", "Jenkins.Net.zip");
54+
55+
try {
56+
Context.WriteTagLine("Creating project package...", ConsoleColor.White);
57+
58+
await ProjectPackageTools.CreatePackage(
59+
definition: def,
60+
rootPath: Context.ContentDirectory,
61+
version: version,
62+
outputFilename: output);
63+
64+
Context.WriteTagLine("Created project package successfully.", ConsoleColor.White);
65+
}
66+
catch (Exception error) {
67+
Context.WriteErrorBlock("Failed to create project package!", error.UnfoldMessages());
68+
throw;
69+
}
70+
71+
try {
72+
Context.WriteTagLine("Publishing project package...", ConsoleColor.White);
4973

50-
await ProjectPackageTools.CreatePackage(
51-
definition: def,
52-
rootPath: Context.WorkDirectory,
53-
version: version,
54-
outputFilename: output);
74+
await Context.Packages.PushProjectPackageAsync(output, token);
5575

56-
await Context.Packages.PushProjectPackageAsync(output, token);
76+
Context.WriteTagLine("Published project package successfully.", ConsoleColor.White);
77+
}
78+
catch (Exception error) {
79+
Context.WriteErrorBlock("Failed to publish project package!", error.UnfoldMessages());
80+
throw;
81+
}
5782
}
5883

5984
private async Task CreateNugetPackage(string packageDir, CancellationToken token)

Jenkins.Net.Publishing/Scripts/Publish.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using System.Threading;
77
using System.Threading.Tasks;
8+
using Path = System.IO.Path;
89

910
namespace Jenkins.NET.Publishing.Scripts
1011
{
@@ -22,8 +23,10 @@ public async Task RunAsync(CancellationToken token)
2223
};
2324
nugetCore.Initialize();
2425

26+
var packageDir = Path.Combine(Context.ContentDirectory, "PublishPackages");
27+
2528
var packageFilename = Directory
26-
.GetFiles(Context.ContentDirectory, "jenkinsnet.*.nupkg")
29+
.GetFiles(packageDir, "jenkinsnet.*.nupkg")
2730
.FirstOrDefault();
2831

2932
if (string.IsNullOrEmpty(packageFilename))

0 commit comments

Comments
 (0)