Skip to content

Commit f7566b8

Browse files
authored
chore: adjust publish and testing (#113)
* adjust namings and correct licence * adjust release and testing
1 parent da84dae commit f7566b8

File tree

14 files changed

+75
-51
lines changed

14 files changed

+75
-51
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
# These are supported funding model platforms
2-
31
github: [buehler]
42
custom: ['https://paypal.me/rbbit']

.github/workflows/dotnet-release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: .NET Core Release
1+
name: .NET Release
22

33
on: [workflow_dispatch]
44

@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10-
- name: Setup .NET Core
10+
- name: Setup .NET
1111
uses: actions/setup-dotnet@v1
1212
with:
1313
dotnet-version: 5.0.100
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v2
2121
with:
2222
fetch-depth: 1
23-
- name: Setup .NET Core
23+
- name: Setup .NET
2424
uses: actions/setup-dotnet@v1
2525
with:
2626
dotnet-version: 5.0.100
@@ -30,5 +30,8 @@ jobs:
3030
extra_plugins: |
3131
@semantic-release/exec
3232
env:
33-
NUGET_KEY: ${{ secrets.NUGET_KEY }}
33+
NUGET_SOURCE: 'https://api.nuget.org/v3/index.json'
34+
NUGET_API_KEY: ${{ secrets.NUGET_KEY }}
35+
GH_NUGET_SOURCE: 'https://nuget.pkg.github.com/buehler/index.json'
36+
GH_NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
3437
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/dotnet-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: .NET Core Testing
1+
name: .NET Testing
22

33
on:
44
push:
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v2
16-
- name: Setup .NET Core
16+
- name: Setup .NET
1717
uses: actions/setup-dotnet@v1
1818
with:
1919
dotnet-version: 5.0.100

.github/workflows/github-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: windows-latest
1010
steps:
1111
- uses: actions/checkout@v2
12-
- name: Setup .NET Core
12+
- name: Setup .NET
1313
uses: actions/setup-dotnet@v1
1414
with:
1515
dotnet-version: 5.0.100

.github/workflows/security-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
languages: ${{ matrix.language }}
3434

35-
- name: Setup .NET Core
35+
- name: Setup .NET
3636
uses: actions/setup-dotnet@v1
3737
with:
3838
dotnet-version: 5.0.100

.releaserc.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[
66
"@semantic-release/exec",
77
{
8-
"prepareCmd": "./build.sh --no-logo --version ${nextRelease.version} --target Pack"
8+
"prepareCmd": "./build.sh --no-logo --version ${nextRelease.version} --release-notes '${nextRelease.notes}' --target Pack"
99
}
1010
]
1111
],
@@ -19,7 +19,13 @@
1919
[
2020
"@semantic-release/exec",
2121
{
22-
"publishCmd": "./build.sh --no-logo --target Publish"
22+
"publishCmd": "./build.sh --no-logo --target Publish --source-env GH_NUGET_SOURCE --api-key-env GH_NUGET_API_KEY"
23+
}
24+
],
25+
[
26+
"@semantic-release/exec",
27+
{
28+
"publishCmd": "./build.sh --no-logo --target Publish --source-env NUGET_SOURCE --api-key-env NUGET_API_KEY"
2329
}
2430
]
2531
]

DotnetOperatorSdk.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{95F3A6DD-B421-441D-B263-1B34A1465FF5}"
77
ProjectSection(SolutionItems) = preProject
88
README.md = README.md
9+
LICENSE = LICENSE
910
EndProjectSection
1011
EndProject
1112
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KubeOps", "src\KubeOps\KubeOps.csproj", "{D7AB6CB9-94B6-4FEB-B7D8-D8AA793BD2A4}"

LICENSE

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
Copyright 2020 Christoph Bühler
1+
This is free and unencumbered software released into the public domain.
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
47

5-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
615

7-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# KubeOps
22

33
![Code Security Testing](https://github.com/buehler/dotnet-operator-sdk/workflows/Code%20Security%20Testing/badge.svg)
4-
![.NET Core Release](https://github.com/buehler/dotnet-operator-sdk/workflows/.NET%20Core%20Release/badge.svg)
5-
![.NET Core Testing](https://github.com/buehler/dotnet-operator-sdk/workflows/.NET%20Core%20Testing/badge.svg)
4+
![.NET Release](https://github.com/buehler/dotnet-operator-sdk/workflows/.NET%20Release/badge.svg)
5+
![.NET Testing](https://github.com/buehler/dotnet-operator-sdk/workflows/.NET%20Testing/badge.svg)
66
[![Nuget](https://img.shields.io/nuget/v/KubeOps)](https://www.nuget.org/packages/KubeOps/)
77

88
This is the repository of the dotnet kubernetes operator sdk.

build/Build.cs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Linq;
34
using GlobExpressions;
@@ -14,11 +15,18 @@
1415
[UnsetVisualStudioEnvironmentVariables]
1516
class Build : NukeBuild
1617
{
18+
const short MaxReleaseNoteLength = 30000;
19+
1720
public static int Main() => Execute<Build>(x => x.Test);
1821

1922
[Parameter("Version of the nuget package to build.")] readonly string Version = string.Empty;
2023

21-
string NugetVersion => Version.StartsWith("v") ? Version.Substring(1) : Version;
24+
[Parameter("Optional release notes to append.")] readonly string ReleaseNotes = string.Empty;
25+
26+
[Parameter("Name of the environment variable that contains the api key.")] readonly string ApiKeyEnv = string.Empty;
27+
28+
[Parameter("Name of the environment variable that contains the nuget source.")]
29+
readonly string SourceEnv = string.Empty;
2230

2331
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
2432
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
@@ -31,6 +39,12 @@ class Build : NukeBuild
3139

3240
IEnumerable<Project> Projects => Solution.AllProjects.Where(p => p.SolutionFolder?.Name == "src");
3341

42+
string PackageReleaseNotes => (ReleaseNotes.Length > MaxReleaseNoteLength
43+
? ReleaseNotes.Substring(0, MaxReleaseNoteLength)
44+
: ReleaseNotes)
45+
.Replace(",", "%2c")
46+
.Replace(";", "%3b");
47+
3448
Target Clean => _ => _
3549
.Before(Restore)
3650
.Executes(() =>
@@ -56,24 +70,29 @@ class Build : NukeBuild
5670
.SetProjectFile(Solution)
5771
.SetConfiguration(Configuration)
5872
.SetProperty("CollectCoverage", true)
73+
.EnableNoRestore()
5974
.EnableNoBuild()));
6075

6176
Target Pack => _ => _
6277
.DependsOn(Clean, Restore)
6378
.Requires(() => !string.IsNullOrWhiteSpace(Version))
6479
.Executes(() => DotNetPack(s => s
6580
.SetConfiguration(Configuration.Release)
66-
.SetVersion(NugetVersion)
81+
.SetVersion(Version)
82+
.SetPackageReleaseNotes(PackageReleaseNotes)
6783
.SetOutputDirectory(ArtifactsDirectory)
6884
.CombineWith(Projects, (ss, proj) => ss
6985
.SetProject(proj))));
7086

7187
Target Publish => _ => _
7288
.Requires(
73-
() => !string.IsNullOrWhiteSpace(EnvironmentInfo.GetVariable<string>("NUGET_KEY", null)))
89+
() => !string.IsNullOrWhiteSpace(ApiKeyEnv) &&
90+
!string.IsNullOrWhiteSpace(SourceEnv) &&
91+
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(ApiKeyEnv)) &&
92+
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(SourceEnv)))
7493
.Executes(() => DotNetNuGetPush(s => s
75-
.SetSource("https://api.nuget.org/v3/index.json")
76-
.SetApiKey(EnvironmentInfo.GetVariable<string>("NUGET_KEY", null))
94+
.SetSource(Environment.GetEnvironmentVariable(SourceEnv) ?? string.Empty)
95+
.SetApiKey(Environment.GetEnvironmentVariable(ApiKeyEnv) ?? string.Empty)
7796
.CombineWith(Glob.Files(ArtifactsDirectory, "*.nupkg"), (ss, package) => ss
7897
.SetTargetPath(ArtifactsDirectory / package))));
7998
}

0 commit comments

Comments
 (0)