diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8af687e1..c46dde1b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,5 +20,5 @@ jobs:
working-directory: ./build
run: |
dotnet new tool-manifest
- dotnet tool install cake.tool --version 4.0.0
+ dotnet tool install cake.tool --version 5.0.0
dotnet cake
diff --git a/.github/workflows/bump-up-version.yml b/.github/workflows/bump-up-version.yml
index 5cd5a9dc..4b1ba60e 100644
--- a/.github/workflows/bump-up-version.yml
+++ b/.github/workflows/bump-up-version.yml
@@ -30,8 +30,8 @@ jobs:
git config --local user.name "${{ github.actor }}"
git config --local user.email "836904362@qq.com"
dotnet new tool-manifest
- dotnet tool install cake.tool --version 4.0.0
- dotnet cake --target publish --username="${{ github.actor }}" --email="836904362@qq.com" --pre-release=${{ inputs.pre_release }} --nuget-token=${{ secrets.NUGETTOKEN }}
+ dotnet tool install cake.tool --version 5.0.0
+ dotnet cake --target publish --username="${{ github.actor }}" --email="836904362@qq.com" --pre-release=${{ inputs.pre_release }} --nuget-token=${{ secrets.NUGETTOKEN }} --github-token=${{ secrets.GITHUB_TOKEN }}
- name: Push git changes
uses: ad-m/github-push-action@master
@@ -39,12 +39,3 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
-
- - name: Create github release
- uses: softprops/action-gh-release@v2
- with:
- # For maximum compatibility, we choose the .net40
- files: ./build/outputs/installer/net40/*
- body_path: ./build/outputs/CHANGELOG.md
- token: ${{ secrets.GITHUB_TOKEN }}
- prerelease: ${{ inputs.pre_release }}
diff --git a/build/build.cake b/build/build.cake
index 4117b2b8..678f5b8a 100644
--- a/build/build.cake
+++ b/build/build.cake
@@ -1,4 +1,5 @@
-#addin nuget:?package=Cake.Git&version=4.0.0
+#addin nuget:?package=Cake.Git&version=5.0.1
+#addin nuget:?package=Cake.GitHub&version=1.0.0
#tool nuget:?package=NuGet.CommandLine&version=6.9.1
using System;
@@ -26,6 +27,7 @@ var preRelease = Argument("pre-release", false);
var username = Argument("username", "NaBian");
var email = Argument("email", "836904362@qq.com");
var nugetToken = Argument("nuget-token", "");
+var githubToken = Argument("github-token", "");
var libVersion = "";
var nugetVersion = "";
@@ -127,13 +129,14 @@ Task("commit files")
var exitCode = StartProcess(
"git",
- new ProcessSettings {
+ new ProcessSettings
+ {
Arguments = "diff --cached --quiet",
WorkingDirectory = gitRootPath
}
);
-
- if(exitCode == 0)
+
+ if (exitCode == 0)
{
Information("no change.");
return;
@@ -345,6 +348,33 @@ Task("push to nuget")
});
});
+Task("create github release")
+ .Does(async () =>
+{
+ await GitHubCreateReleaseAsync(
+ /// The user name to use for authentication (pass null when using an access token).
+ userName: null,
+ /// The access token or password to use for authentication.
+ apiToken: githubToken,
+ // The owner (user or group) of the repository to create a release in.
+ owner: "HandyOrg",
+ /// The name of the repository to create a release in.
+ repository: "HandyControl",
+ /// The name of the tag to create a release for.
+ /// If the tag does not yet exist, a new tag will be created (using either the HEAD of the default branch or the commit specified in the settings).
+ /// If the tag already exists, the existing tag will be used and the commit specified in the settings will be ignored.
+ tagName: $"v{nugetVersion}",
+ settints: new GitHubCreateReleaseSettings
+ {
+ ReleaseName = $"Release v{nugetVersion}",
+ Body = ReadAllText(Combine(buildConfig.OutputsFolder, "CHANGELOG.md"), Encoding.UTF8),
+ Prerelease = preRelease,
+ Overwrite = false,
+ Assets = GetFiles("../build/outputs/installer/net40/*").ToArray(),
+ }
+ );
+});
+
Task("publish")
.IsDependentOn("update license")
.IsDependentOn("update version")
@@ -362,6 +392,7 @@ Task("publish")
.IsDependentOn("pack nuspec files")
.IsDependentOn("create demo installers")
.IsDependentOn("push to nuget")
+ .IsDependentOn("create github release")
;
Task("build")
diff --git a/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj b/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj
index e388cf10..a343260c 100644
--- a/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj
@@ -6,7 +6,7 @@
Contains some simple and commonly used WPF controls
HandyControl
snupkg
- 0067;0649;1591;MSB3061;SYSLIB0003;SYSLIB0004;SYSLIB0032
+ 0067;0649;1591;MSB3061;SYSLIB0003;SYSLIB0004;SYSLIB0032;CA2022
NETSDK1138
..\..\Shared\HandyControl_Shared\key.snk
true