Skip to content

Commit 7cee737

Browse files
authored
Merge pull request #3377 from arturcic/feature/2193
#2193 - create a chocolatey metapackage
2 parents 6b8a4ca + 46a6c74 commit 7cee737

File tree

5 files changed

+42
-30
lines changed

5 files changed

+42
-30
lines changed

build/build/Tasks/Package/PackageChocolatey.cs

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,50 @@ public override void Run(BuildContext context)
2121
{
2222
context.EnsureDirectoryExists(Paths.Nuget);
2323

24-
var portableNuspecFile = Paths.Nuspec.CombineWithFilePath("GitVersion.Portable.nuspec");
25-
if (!context.FileExists(portableNuspecFile))
26-
return;
27-
2824
var artifactPath = context.MakeAbsolute(Paths.ArtifactsBinPortable).FullPath;
2925

26+
var portableSettings = GetChocolateyPackSettings(context, "GitVersion.Portable");
27+
portableSettings.Files = context.GetFiles(artifactPath + "/**/*.*")
28+
.Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") })
29+
.ToArray();
30+
31+
context.ChocolateyPack(portableSettings);
32+
33+
var metaPackageSettings = GetChocolateyPackSettings(context, "GitVersion");
34+
metaPackageSettings.Files = context.GetFiles(artifactPath + "/**/*.txt")
35+
.Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") })
36+
.ToArray();
37+
38+
metaPackageSettings.Dependencies = new[]
39+
{
40+
new ChocolateyNuSpecDependency { Id = "GitVersion.Portable", Version = context.Version?.ChocolateyVersion }
41+
};
42+
43+
context.ChocolateyPack(metaPackageSettings);
44+
}
45+
46+
private static ChocolateyPackSettings GetChocolateyPackSettings(BuildContextBase context, string id)
47+
{
3048
var chocolateySettings = new ChocolateyPackSettings
3149
{
32-
LimitOutput = true,
50+
Id = id,
3351
Version = context.Version?.ChocolateyVersion,
52+
Title = "GitVersion",
53+
Description = "Derives SemVer information from a repository following GitFlow or GitHubFlow.",
54+
Authors = new[] { "GitTools and Contributors" },
55+
Owners = new[] { "GitTools and Contributors" },
56+
Copyright = $"Copyright GitTools {DateTime.Now.Year}",
57+
DocsUrl = new Uri("https://gitversion.net/docs/"),
58+
LicenseUrl = new Uri("https://opensource.org/license/mit/"),
59+
ProjectUrl = new Uri("https://github.com/GitTools/GitVersion"),
60+
ProjectSourceUrl = new Uri("https://github.com/GitTools/GitVersion"),
61+
IconUrl = new Uri("https://raw.githubusercontent.com/GitTools/graphics/master/GitVersion/Color/icon_100x100.png"),
62+
RequireLicenseAcceptance = false,
63+
Tags = new[] { "Git", "Versioning", "GitVersion", "GitFlowVersion", "GitFlow", "GitHubFlow", "SemVer" },
64+
ReleaseNotes = new[] { $"https://github.com/GitTools/GitVersion/releases/tag/{context.Version?.ChocolateyVersion}" },
3465
OutputDirectory = Paths.Nuget,
35-
Files = context.GetFiles(artifactPath + "/**/*.*")
36-
.Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") })
37-
.ToArray()
66+
LimitOutput = true,
3867
};
39-
context.ChocolateyPack(portableNuspecFile, chocolateySettings);
68+
return chocolateySettings;
4069
}
4170
}

build/nuspec/GitVersion.Portable.nuspec

Lines changed: 0 additions & 18 deletions
This file was deleted.

build/nuspec/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ works out the [Semantic Version][semver] of the commit being built.
88
| Artifact | Stable | |
99
| :------------------------- | :----------------------------------------------------------------- | - |
1010
| **GitVersion.Tool** | [![NuGet][gvgt-badge]][gvgt] |
11-
| **GitVersion.CommandLine** | [![NuGet][gvcl-badge]][gvcl] |
1211
| **GitVersion.MsBuild** | [![NuGet][gvt-badge]][gvt] | Known as [GitVersionTask][gitversiontask] before v5.6.0 |
1312

1413
## Compatibility

build/nuspec/VERIFICATION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ in verifying that this package's contents are trustworthy.
44

55
This package is published by the GitTools organization itself. The binaries are
66
identical to other package types published by the project, in particular
7-
the GitVersion.Portable nuget package.
7+
the GitVersion.Portable and GitVersion nuget package.

build/publish/BuildLifetime.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public override void Setup(BuildContext context, ISetupContext info)
2020
foreach (var packageFile in nugetPackagesFiles)
2121
{
2222
var packageName = packageFile.GetFilenameWithoutExtension().ToString()[..^(nugetVersion.Length + 1)].ToLower();
23-
context.Packages.Add(new NugetPackage(packageName, packageFile, packageName.Contains("Portable", StringComparison.OrdinalIgnoreCase)));
23+
var isChocoPackage = packageName.Equals("GitVersion.Portable", StringComparison.OrdinalIgnoreCase) ||
24+
packageName.Equals("GitVersion", StringComparison.OrdinalIgnoreCase);
25+
context.Packages.Add(new NugetPackage(packageName, packageFile, isChocoPackage));
2426
}
2527
}
2628
context.StartGroup("Build Setup");

0 commit comments

Comments
 (0)