Skip to content

Commit

Permalink
Merge branch 'release/v4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Mar 6, 2024
2 parents 636df73 + 35b3c39 commit 296404c
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.0.0",
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-latest, macos-latest, windows-2019, windows-2022]
os: [ubuntu-20.04, ubuntu-latest, macos-latest, windows-2019, windows-2022]
steps:
- name: Get the sources
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install .NET Core SDK (global.json)
uses: actions/setup-dotnet@v1
- name: Install .NET SDK (global.json)
uses: actions/setup-dotnet@v4
with:
include-prerelease: 'true'
global-json-file: 'global.json'

- name: Run Cake script
uses: cake-build/cake-action@v1
uses: cake-build/cake-action@v2
env:
matrix-os: ${{ matrix.os }}
with:
Expand Down
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp.

| Build server | Platform | Status |
|-----------------------------|--------------|---------------------------------------------------------------------------------------------------------------------------|
| AppVeyor | Windows | [![Build status](https://ci.appveyor.com/api/projects/status/mycuknigvm2418ht/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-git/branch/develop) |
| Travis | Linux / OS X | [![Build Status](https://travis-ci.org/cake-contrib/Cake_Git.svg?branch=develop)](https://travis-ci.org/cake-contrib/Cake_Git) |
| Build server | Platform | Status |
|-----------------------------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| AppVeyor | Windows | [![Build status](https://ci.appveyor.com/api/projects/status/mycuknigvm2418ht/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-git/branch/develop) |
| GitHub Actions | Windows / Linux / macOS | [![Build status](https://github.com/cake-contrib/Cake_Git/actions/workflows/build.yml/badge.svg)](https://github.com/cake-contrib/Cake_Git/actions/workflows/build.yml) |

## Documentation

Expand Down
7 changes: 7 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### New in 4.0.0 (Released 2024/03/06)

* Update to Cake 4.0
* Multi-Target .NET 6, 7 & 8
* Update to LibGit2Sharp 0.29.0
* Introduce Cake.Frosting.Git addin for using with Cake Frosting

### New in 3.0.0 (Released 2022/12/14)

* Update Cake.Git to target Cake.Core 3.0.0 and net7.0 TFM
Expand Down
13 changes: 13 additions & 0 deletions ReleaseProcess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# How to release a new version of Cake.Git

* Create release branch `release/vMajor.Minor.Patch` from `develop` (e.g. `git branch release/v3.1.4 develop`)
* Go to the branch (e.g. `git checkout release/v3.1.4`)
* Update the [`ReleaseNotes.md`](ReleaseNotes.md) (the build version number comes from parsing this file)
* Merge the release branch into the `master` branch (e.g. `git merge master`)
* Tag the updated `master` branch with the version (e.g. `git tag v3.1.4`)
* Push the `master` branch with the tag to GitHub (e.g. `git push origin master --tags`)
* The [AppVeyor build](https://ci.appveyor.com/project/cakecontrib/cake-git/history) will publish the NuGet package automatically
* Merge the `master` branch into into `develop` to bring the updated [`ReleaseNotes.md`](ReleaseNotes.md)
* Create and publish a new [release](https://github.com/cake-contrib/Cake_Git/releases) on GitHub
* Close the [milestone](https://github.com/cake-contrib/Cake_Git/milestones) on GitHub
* Publish a notification of the release on the [Cake-Contrib](https://twitter.com/cakecontrib) Twitter account ([see example](https://twitter.com/cakecontrib/status/1603138374994468864))
11 changes: 11 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Operating system (build VM template)
os: Visual Studio 2022

# Ensure required .NET SDKs are installed
install:
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
- ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1"
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.418 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.405 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 8.0.101 -InstallDir $env:DOTNET_INSTALL_DIR'
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
- ps: dotnet --info

# Build script
build_script:
- ps: .\build.ps1 --target AppVeyor
Expand Down
77 changes: 67 additions & 10 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ Setup(ctx =>

var assemblyInfo = new AssemblyInfoSettings {
Title = "Cake.Git",
Description = "Cake Git AddIn",
Description = "This addin provides aliases for running Git commands from Cake scripts. It is a thin wrapper around the LibGit2Sharp library and provides a way to interact with Git repositories from Cake scripts.",
Product = "Cake.Git",
Company = "WCOM AB",
Version = version,
FileVersion = version,
InformationalVersion = semVersion,
Copyright = string.Format("Copyright © WCOM AB {0}", DateTime.Now.Year),
CLSCompliant = true
CLSCompliant = false
};


Expand All @@ -76,7 +76,7 @@ Setup(ctx =>
isLocalBuild,
configuration,
target,
new[]{ "net6.0", "net7.0" },
new[]{ "net6.0", "net7.0", "net8.0" },
new DotNetMSBuildSettings()
.WithProperty("Version", semVersion)
.WithProperty("AssemblyVersion", version)
Expand Down Expand Up @@ -112,6 +112,7 @@ Setup(ctx =>
artifactsRoot,
nugetRoot,
nugetRoot.CombineWithFilePath("Cake.Git." + semVersion + ".nupkg"),
nugetRoot.CombineWithFilePath("Cake.Frosting.Git." + semVersion + ".nupkg"),
GetFiles("./**/*.sln")
.ToArray(),
MakeAbsolute(Directory("./tools/Addins/Cake.Git/Cake.Git"))));
Expand Down Expand Up @@ -210,6 +211,10 @@ Task("Publish-Artifacts")


Task("Create-NuGet-Package")
.IsDependentOn("Create-NuGet-Package-Scripting")
.IsDependentOn("Create-NuGet-Package-Frosting");

Task("Create-NuGet-Package-Scripting")
.IsDependentOn("Publish-Artifacts")
.Does<BuildData>(static (context, data) =>
{
Expand All @@ -218,6 +223,11 @@ Task("Create-NuGet-Package")
var libGit = context.GetFiles(data.BuildPaths.ArtifactsRoot.FullPath + "/**/LibGit2Sharp*");
var unmanaged = context.GetFiles(data.BuildPaths.ArtifactsRoot.FullPath + "/net6.0/runtimes/**/*");

data.NuGetPackSettings.Description += Environment.NewLine + Environment.NewLine +
"NOTE:" + Environment.NewLine +
"The addin currently only runs on x64 processors. ARM processors are not supported." + Environment.NewLine +
"This is the version of the addin compatible with Cake Script Runners." + Environment.NewLine +
"For addin compatible with Cake Frosting see Cake.Frosting.Git.";
data.NuGetPackSettings.Files = (libGit + cakeGit + cakeGitDoc)
.Select(file=>file.FullPath.Substring(data.BuildPaths.ArtifactsRoot.FullPath.Length+1))
.Select(file=>new NuSpecContent {Source = file, Target = "lib/" + file})
Expand All @@ -227,7 +237,7 @@ Task("Create-NuGet-Package")
.Select(file=>new NuSpecContent {Source = file, Target = "/" + file.Substring(7)}))
// cake scripting needs the unmanaged dlls to be in the "wrong" place for some reason..
.Union(unmanaged
.Where(file=>file.FullPath.Contains("/linux-x64/") || file.FullPath.Contains("/win-x64/") || file.FullPath.Contains("/osx/"))
.Where(file=>file.FullPath.Contains("/linux-x64/") || file.FullPath.Contains("/win-x64/") || file.FullPath.Contains("/osx-x64/"))
.SelectMany(file => data.TargetFrameworks.Select(tfm =>
new NuSpecContent {
Source = file.FullPath.Substring(data.BuildPaths.ArtifactsRoot.FullPath.Length+1),
Expand All @@ -249,8 +259,44 @@ Task("Create-NuGet-Package")
context.NuGetPack(data.NuGetPackSettings);
});

Task("Create-NuGet-Package-Frosting")
.IsDependentOn("Publish-Artifacts")
.Does<BuildData>(static (context, data) =>
{
var cakeGit = context.GetFiles(data.BuildPaths.ArtifactsRoot.FullPath + "/**/Cake.Git.dll");
var cakeGitDoc = context.GetFiles(data.BuildPaths.ArtifactsRoot.FullPath + "/**/Cake.Git.xml");

data.NuGetPackSettings.Id = "Cake.Frosting.Git";
data.NuGetPackSettings.Description += Environment.NewLine + Environment.NewLine +
"NOTE:" + Environment.NewLine +
"This is the version of the addin compatible with Cake Frosting." + Environment.NewLine +
"For addin compatible with Cake Script Runners see Cake.Git." + Environment.NewLine;
data.NuGetPackSettings.Files = (cakeGit + cakeGitDoc)
.Select(file=>file.FullPath.Substring(data.BuildPaths.ArtifactsRoot.FullPath.Length+1))
.Select(file=>new NuSpecContent {Source = file, Target = "lib/" + file})
// add the icon
.Union(new []
{
new NuSpecContent
{
Source = context.MakeAbsolute(context.File("./asset/cake-contrib-addin-medium.png")).FullPath,
Target = "images/icon.png",
},
})
.ToArray();
data.NuGetPackSettings.Dependencies = new List<NuSpecDependency>
{
new NuSpecDependency { Id = "Cake.Core", Version = "4.0.0" },
new NuSpecDependency { Id = "LibGit2Sharp", Version = "0.29.0" }
};

context.EnsureDirectoryExists(data.BuildPaths.NuGetRoot);

context.NuGetPack(data.NuGetPackSettings);
});

Task("Test")
.IsDependentOn("Create-NuGet-Package")
.IsDependentOn("Create-NuGet-Package-Scripting")
.WithCriteria<BuildData>(data => StringComparer.OrdinalIgnoreCase.Equals(data.Configuration, "Release"))
.DoesForEach<BuildData, TestCase>(
static (data, context) => {
Expand All @@ -262,7 +308,7 @@ Task("Test")
});
}

context.Unzip(data.BuildPaths.Package, data.BuildPaths.AddinDir);
context.Unzip(data.BuildPaths.ScriptingPackage, data.BuildPaths.AddinDir);

var cakeSettings = new CakeSettings {
Arguments = new Dictionary<string, string> {
Expand Down Expand Up @@ -292,7 +338,8 @@ Task("Upload-AppVeyor-Artifacts")
.Does<BuildData>(data =>
{
// Upload Artifact
AppVeyor.UploadArtifact(data.BuildPaths.Package);
AppVeyor.UploadArtifact(data.BuildPaths.ScriptingPackage);
AppVeyor.UploadArtifact(data.BuildPaths.FrostingPackage);
});

Task("Push-NuGet-Packages")
Expand All @@ -302,7 +349,15 @@ Task("Push-NuGet-Packages")
.Does<BuildData>((context, data) =>
{
context.DotNetNuGetPush(
data.BuildPaths.Package,
data.BuildPaths.ScriptingPackage,
new DotNetNuGetPushSettings
{
Source = data.NuGetSource,
ApiKey = data.NuGetApiKey
}
);
context.DotNetNuGetPush(
data.BuildPaths.FrostingPackage,
new DotNetNuGetPushSettings
{
Source = data.NuGetSource,
Expand All @@ -321,7 +376,8 @@ Task("Upload-GitHubActions-Artifacts")
var suffix = EnvironmentVariable("matrix-os")
?? GitHubActions.Environment.Runner.OS;
Information("Uploading artifacts for {0}...", suffix);
await GitHubActions.Commands.UploadArtifact(data.BuildPaths.Package, string.Concat("NuGet-", suffix));
await GitHubActions.Commands.UploadArtifact(data.BuildPaths.ScriptingPackage, string.Concat("Scripting-NuGet-", suffix));
await GitHubActions.Commands.UploadArtifact(data.BuildPaths.FrostingPackage, string.Concat("Frosting-NuGet-", suffix));
await GitHubActions.Commands.UploadArtifact(data.BuildPaths.ArtifactsRoot, string.Concat("Artifacts-", suffix));
});

Expand Down Expand Up @@ -355,7 +411,8 @@ RunTarget(target);
public record BuildPaths(
DirectoryPath ArtifactsRoot,
DirectoryPath NuGetRoot,
FilePath Package,
FilePath ScriptingPackage,
FilePath FrostingPackage,
ICollection<FilePath> Solutions,
DirectoryPath AddinDir)
{
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"version": "8.0.100",
"rollForward": "feature"
}
}
10 changes: 5 additions & 5 deletions src/Cake.Git/Cake.Git.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
Expand All @@ -18,10 +18,10 @@
<ProjectGuid>{08F0A5C3-0E9C-451D-B003-14FF73699BE1}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0102" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.312" />
<PackageReference Include="Cake.Core" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="LibGit2Sharp" Version="0.29.0" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.321" />
<PackageReference Include="Cake.Core" Version="4.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SolutionInfo.cs" Link="Properties\SolutionInfo.cs" />
Expand Down
3 changes: 0 additions & 3 deletions src/Cake.Git/GitAliases.Branch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

namespace Cake.Git
{
/// <summary>
/// Class GitAliases.
/// </summary>
public static partial class GitAliases
{
/// <summary>
Expand Down
10 changes: 4 additions & 6 deletions src/Cake.Git/GitAliases.Clone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,9 @@ string password

context.FileSystem.GetDirectory(workFullDirectoryPath).Create();

var options = new CloneOptions
{
CredentialsProvider =
(url, user, cred) => new UsernamePasswordCredentials { Username = username, Password = password }
};
var options = new CloneOptions();
options.FetchOptions.CredentialsProvider =
(url, user, cred) => new UsernamePasswordCredentials { Username = username, Password = password };

return Repository.Clone(sourceUrl, workFullDirectoryPath.FullPath, options);
}
Expand Down Expand Up @@ -265,7 +263,7 @@ GitCloneSettings cloneSettings
context.FileSystem.GetDirectory(workFullDirectoryPath).Create();

var options = cloneSettings.ToCloneOptions();
options.CredentialsProvider =
options.FetchOptions.CredentialsProvider =
(url, user, cred) => new UsernamePasswordCredentials { Username = username, Password = password };

return Repository.Clone(sourceUrl, workFullDirectoryPath.FullPath, options);
Expand Down
5 changes: 4 additions & 1 deletion src/Cake.Git/GitAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
namespace Cake.Git
{
/// <summary>
/// Contains functionality for working with GIT using LibGit2 &amp; LibGit2Sharp
/// Contains functionality for working with GIT using LibGit2 &amp; LibGit2Sharp.
///
/// NOTE:
/// The addin currently only runs on x64 processors. ARM processors are not supported.
/// </summary>
[CakeAliasCategory("Git")]
public static partial class GitAliases
Expand Down
2 changes: 1 addition & 1 deletion src/SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyCopyright("Copyright © WCOM AB 2022")]
[assembly: CLSCompliant(true)]
[assembly: CLSCompliant(false)]

2 changes: 2 additions & 0 deletions test_net8.0.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#r "./tools/Addins/Cake.Git/Cake.Git/lib/net8.0/Cake.Git.dll"
#load test.cake

0 comments on commit 296404c

Please sign in to comment.