Skip to content

Commit cd9f98a

Browse files
committed
Add buildkit pipeline and modify build.cake script to support publishing of nuget packages
1 parent b270d8e commit cd9f98a

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

Diff for: build.cake

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var IOSVERSION = Argument("iosversion", "9.2.0");
22
var MACVERSION = Argument("macversion", "4.2.0");
33
var target = Argument ("target", "Default");
4+
var NUGET_API_KEY = EnvironmentVariable("NUGET_API_KEY");
45

56
Task ("MacModel")
67
.Description ("Builds 'PSPDFKit.Mac.Model.dll', expects 'PSPDFKit.framework' inside './PSPDFKit.Mac.Model/' Directory\n")
@@ -25,7 +26,7 @@ Task ("iOSModel")
2526
Information ("=== PSPDFKit.iOS.Model.dll ===");
2627
if (!DirectoryExists ("./PSPDFKit.iOS.Model/PSPDFKit.framework/"))
2728
throw new Exception ("Unable to locate 'PSPDFKit.framework' inside './PSPDFKit.iOS.Model' Directory");
28-
29+
2930
MSBuild ("./PSPDFKit.iOS.Model/PSPDFKit.iOS.Model.csproj", new MSBuildSettings ()
3031
.SetConfiguration ("Release")
3132
);
@@ -140,6 +141,38 @@ Task ("NuGet")
140141
});
141142
});
142143

144+
Task ("NuGet-Push")
145+
.IsDependentOn("Nuget")
146+
.Does (() =>
147+
{
148+
// Get the path to the packages
149+
var modelPackage = "./nuget/pkgs/PSPDFKit.iOS.Model." + IOSVERSION +".nupkg";
150+
var uiPackage = "./nuget/pkgs/PSPDFKit.iOS.UI." + IOSVERSION +".nupkg";
151+
var instantPackage = "./nuget/pkgs/PSPDFKit.iOS.Instant." + IOSVERSION +".nupkg";
152+
var macModelPackage = "./nuget/pkgs/PSPDFKit.Mac.Model." + MACVERSION +".nupkg";
153+
154+
// Push the packages
155+
NuGetPush(modelPackage, new NuGetPushSettings {
156+
Source = "https://api.nuget.org/v3/index.json",
157+
ApiKey = NUGET_API_KEY
158+
});
159+
160+
NuGetPush(uiPackage, new NuGetPushSettings {
161+
Source = "https://api.nuget.org/v3/index.json",
162+
ApiKey = NUGET_API_KEY
163+
});
164+
165+
NuGetPush(instantPackage, new NuGetPushSettings {
166+
Source = "https://api.nuget.org/v3/index.json",
167+
ApiKey = NUGET_API_KEY
168+
});
169+
170+
NuGetPush(macModelPackage, new NuGetPushSettings {
171+
Source = "https://api.nuget.org/v3/index.json",
172+
ApiKey = NUGET_API_KEY
173+
});
174+
});
175+
143176
Task ("Clean")
144177
.Description ("Cleans the build.\n")
145178
.Does (() => {
@@ -189,4 +222,4 @@ Task ("Clean")
189222
}
190223
);
191224

192-
RunTarget (target);
225+
RunTarget (target);

Diff for: ci/pipelines/release.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
steps:
2+
- label: 'Build Nuget Packages'
3+
command: '( ./build.sh --Target=Nuget )'
4+
agents:
5+
macos: true
6+
7+
- wait
8+
9+
- block: ':rocket: Release'
10+
11+
- label: 'Upload Nuget Packages'
12+
command: '( ./build.sh --Target=Nuget-Push)'
13+
agents:
14+
macos: true

0 commit comments

Comments
 (0)