-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58120f5
commit e264aab
Showing
55 changed files
with
938 additions
and
760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
COMPOSE_PROJECT_NAME=K4os.Text.BaseX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# ------------------------------------------------------------------------------ | ||
# <auto-generated> | ||
# | ||
# This code was generated. | ||
# | ||
# - To turn off auto-generation set: | ||
# | ||
# [GitHubActions (AutoGenerate = false)] | ||
# | ||
# - To trigger manual generation invoke: | ||
# | ||
# nuke --generate-configuration GitHubActions_continuous --host GitHubActions | ||
# | ||
# </auto-generated> | ||
# ------------------------------------------------------------------------------ | ||
|
||
name: continuous | ||
|
||
on: [push] | ||
|
||
jobs: | ||
windows-latest: | ||
name: windows-latest | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache .nuke/temp, ~/.nuget/packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.nuke/temp | ||
~/.nuget/packages | ||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} | ||
- name: Run './build.cmd Release' | ||
run: ./build.cmd Release | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: .output | ||
path: .output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ packages/ | |
BenchmarkDotNet.Artifacts/ | ||
|
||
.secrets.cfg | ||
*.snk | ||
.signing.snk | ||
|
||
*.bak | ||
*.bak | ||
*.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
temp/ | ||
bin/ | ||
obj/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Build Schema", | ||
"$ref": "#/definitions/build", | ||
"definitions": { | ||
"build": { | ||
"type": "object", | ||
"properties": { | ||
"Continue": { | ||
"type": "boolean", | ||
"description": "Indicates to continue a previously failed build attempt" | ||
}, | ||
"Debug": { | ||
"type": "boolean", | ||
"description": "Use debug configuration" | ||
}, | ||
"Help": { | ||
"type": "boolean", | ||
"description": "Shows the help text for this build assembly" | ||
}, | ||
"Host": { | ||
"type": "string", | ||
"description": "Host for execution. Default is 'automatic'", | ||
"enum": [ | ||
"AppVeyor", | ||
"AzurePipelines", | ||
"Bamboo", | ||
"Bitbucket", | ||
"Bitrise", | ||
"GitHubActions", | ||
"GitLab", | ||
"Jenkins", | ||
"Rider", | ||
"SpaceAutomation", | ||
"TeamCity", | ||
"Terminal", | ||
"TravisCI", | ||
"VisualStudio", | ||
"VSCode" | ||
] | ||
}, | ||
"NoLogo": { | ||
"type": "boolean", | ||
"description": "Disables displaying the NUKE logo" | ||
}, | ||
"Partition": { | ||
"type": "string", | ||
"description": "Partition to use on CI" | ||
}, | ||
"Plan": { | ||
"type": "boolean", | ||
"description": "Shows the execution plan (HTML)" | ||
}, | ||
"Profile": { | ||
"type": "array", | ||
"description": "Defines the profiles to load", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"Root": { | ||
"type": "string", | ||
"description": "Root directory during build execution" | ||
}, | ||
"Skip": { | ||
"type": "array", | ||
"description": "List of targets to be skipped. Empty list skips all dependencies", | ||
"items": { | ||
"type": "string", | ||
"enum": [ | ||
"Build", | ||
"Clean", | ||
"PublishToGitHub", | ||
"PublishToNuget", | ||
"Rebuild", | ||
"Release", | ||
"Restore", | ||
"Test" | ||
] | ||
} | ||
}, | ||
"Solution": { | ||
"type": "string", | ||
"description": "Path to a solution file that is automatically loaded" | ||
}, | ||
"Target": { | ||
"type": "array", | ||
"description": "List of targets to be invoked. Default is '{default_target}'", | ||
"items": { | ||
"type": "string", | ||
"enum": [ | ||
"Build", | ||
"Clean", | ||
"PublishToGitHub", | ||
"PublishToNuget", | ||
"Rebuild", | ||
"Release", | ||
"Restore", | ||
"Test" | ||
] | ||
} | ||
}, | ||
"Verbosity": { | ||
"type": "string", | ||
"description": "Logging verbosity during build execution. Default is 'Normal'", | ||
"enum": [ | ||
"Minimal", | ||
"Normal", | ||
"Quiet", | ||
"Verbose" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[*.cs] | ||
dotnet_style_qualification_for_field = false:warning | ||
dotnet_style_qualification_for_property = false:warning | ||
dotnet_style_qualification_for_method = false:warning | ||
dotnet_style_qualification_for_event = false:warning | ||
dotnet_style_require_accessibility_modifiers = never:warning | ||
|
||
csharp_style_expression_bodied_methods = true:silent | ||
csharp_style_expression_bodied_properties = true:warning | ||
csharp_style_expression_bodied_indexers = true:warning | ||
csharp_style_expression_bodied_accessors = true:warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using Nuke.Common.Tooling; | ||
|
||
[TypeConverter(typeof(TypeConverter<Configuration>))] | ||
public class Configuration : Enumeration | ||
{ | ||
public static Configuration Debug = new Configuration { Value = nameof(Debug) }; | ||
public static Configuration Release = new Configuration { Value = nameof(Release) }; | ||
|
||
public static implicit operator string(Configuration configuration) | ||
{ | ||
return configuration.Value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- This file prevents unintended imports of unrelated MSBuild files --> | ||
<!-- Uncomment to include parent Directory.Build.props file --> | ||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />--> | ||
|
||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- This file prevents unintended imports of unrelated MSBuild files --> | ||
<!-- Uncomment to include parent Directory.Build.targets file --> | ||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />--> | ||
|
||
<ItemGroup> | ||
<None Remove="../../Directory.Build.*" Visible="false"/> | ||
<None Remove="Directory.Build.*" Visible="false"/> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace System; | ||
|
||
public static class Extensions | ||
{ | ||
public static string Join(this IEnumerable<string> source, string separator) => | ||
string.Join(separator, source); | ||
|
||
[CanBeNull] | ||
public static string NullIfEmpty([CanBeNull] this string value) => | ||
string.IsNullOrWhiteSpace(value) ? null : value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using NuGet.Versioning; | ||
using Nuke.Common.ChangeLog; | ||
using Nuke.Common.Git; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Tools.GitHub; | ||
using Nuke.Common.Tools.GitVersion; | ||
using Octokit; | ||
using Octokit.Internal; | ||
using Serilog; | ||
|
||
public class GitHubReleaser | ||
{ | ||
static async Task UploadReleaseAssetToGithub(Release release, string asset) | ||
{ | ||
await using var artifactStream = File.OpenRead(asset); | ||
var fileName = Path.GetFileName(asset); | ||
var assetUpload = new ReleaseAssetUpload { | ||
FileName = fileName, | ||
ContentType = "application/octet-stream", | ||
RawData = artifactStream, | ||
}; | ||
Log.Information("Uploading {FileName}...", fileName); | ||
await GitHubTasks.GitHubClient.Repository.Release.UploadAsset(release, assetUpload); | ||
} | ||
|
||
public static async Task Release( | ||
string token, | ||
NuGetVersion packageVersion, | ||
GitRepository gitRepository, | ||
GitVersion gitVersion, | ||
ReleaseNotes releaseNotes, | ||
AbsolutePath[] artifacts) | ||
{ | ||
var credentials = new Credentials(token); | ||
|
||
GitHubTasks.GitHubClient = new GitHubClient( | ||
new ProductHeaderValue(nameof(GitHubReleaser)), | ||
new InMemoryCredentialStore(credentials)); | ||
|
||
var releaseTag = packageVersion.ToString(); | ||
var repositoryOwner = gitRepository.GetGitHubOwner(); | ||
var repositoryName = gitRepository.GetGitHubName(); | ||
|
||
Log.Information("Creating draft release {ReleaseTag}...", releaseTag); | ||
|
||
var newRelease = new NewRelease(releaseTag) { | ||
TargetCommitish = gitVersion.Sha, | ||
Draft = true, | ||
Name = $"v{releaseTag}", | ||
Prerelease = packageVersion.IsPrerelease, | ||
Body = releaseNotes.Notes.Join("\n"), | ||
}; | ||
|
||
var createdRelease = await GitHubTasks | ||
.GitHubClient | ||
.Repository | ||
.Release.Create(repositoryOwner, repositoryName, newRelease); | ||
|
||
foreach (var artifact in artifacts) | ||
await UploadReleaseAssetToGithub(createdRelease, artifact); | ||
|
||
Log.Information("Publishing release {ReleaseTag}...", releaseTag); | ||
await GitHubTasks | ||
.GitHubClient | ||
.Repository | ||
.Release | ||
.Edit( | ||
repositoryOwner, repositoryName, createdRelease.Id, | ||
new ReleaseUpdate { Draft = false }); | ||
} | ||
} |
Oops, something went wrong.