Skip to content

Commit af65143

Browse files
committed
github actions added
1 parent 16359ed commit af65143

File tree

7 files changed

+189
-3
lines changed

7 files changed

+189
-3
lines changed

.build/Pipelines/GitHubActions.cs

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
using Nuke.Common;
3+
using Nuke.Common.CI.GitHubActions;
4+
using Serilog;
5+
6+
// ReSharper disable UnusedMember.Local
7+
// ReSharper disable AllUnderscoreLocalParameterName
8+
9+
[GitHubActions(
10+
"cd-publish-shared",
11+
GitHubActionsImage.WindowsLatest,
12+
InvokedTargets = [
13+
nameof(Shared_Push),
14+
],
15+
ImportSecrets = ["NUGET_PUSH_SHARED"],
16+
OnWorkflowDispatchOptionalInputs = ["SharedLibVersion"]
17+
)]
18+
19+
[GitHubActions(
20+
"cd-publish-extension",
21+
GitHubActionsImage.WindowsLatest,
22+
InvokedTargets = [
23+
nameof(Extension_Push),
24+
],
25+
ImportSecrets = ["NUGET_PUSH_SHARED"],
26+
OnWorkflowDispatchRequiredInputs = ["ExtensionName"],
27+
OnWorkflowDispatchOptionalInputs = ["ExtensionLibVersion"]
28+
)]
29+
30+
// Continuous Integration: Validate pull requests
31+
[GitHubActions(
32+
"pr-validation",
33+
GitHubActionsImage.UbuntuLatest,
34+
InvokedTargets = [
35+
nameof(Solution_Build),
36+
],
37+
OnPullRequestBranches = ["master"]
38+
)]
39+
[SuppressMessage("ReSharper", "CheckNamespace")]
40+
41+
// CI/CD targets
42+
partial class Build
43+
{
44+
Target UpdateYaml => _ => _.Executes(() => Log.Information("Generating YAML..."));
45+
}

.build/Targets/Extension_Auth_Basic_Targets.cs renamed to .build/Targets/Extension_Targets.cs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
[SuppressMessage("ReSharper", "CheckNamespace")]
1919
partial class Build
2020
{
21-
[Required]
2221
[Parameter("Extension library name")]
2322
string ExtensionName = EnvironmentInfo.GetVariable<string>("EXTENSION_NAME") ?? string.Empty;
2423

.build/Targets/Shared_Targets.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ partial class Build
2424
string SharedLibVersion = EnvironmentInfo.GetVariable<string>("SHARED_LIB_VERSION") ?? string.Empty;
2525

2626
[Parameter("NuGet push API key")]
27-
string PushApiKey => EnvironmentInfo.GetVariable<string>("NUGET_API") ?? Settings.Value<string>("nuget_push_api_key");
27+
string PushApiKey => EnvironmentInfo.GetVariable<string>("NUGET_PUSH_SHARED") ?? Settings.Value<string>("nuget_push_api_key");
2828

2929
Target Shared_FindNextVersion => _ => _
3030
.OnlyWhenDynamic(() => string.IsNullOrWhiteSpace(SharedLibVersion))

.build/Targets/Solution_Targets.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
using System.IO;
1+
using System;
2+
using System.Diagnostics.CodeAnalysis;
3+
using System.IO;
4+
using System.Linq;
25
using Nuke.Common;
36
using Nuke.Common.Tools.DotNet;
47
using static Nuke.Common.Tools.DotNet.DotNetTasks;
58

9+
[SuppressMessage("ReSharper", "AllUnderscoreLocalParameterName")]
10+
[SuppressMessage("ReSharper", "CheckNamespace")]
611
partial class Build
712
{
813
Target Solution_Clean => _ => _
@@ -18,4 +23,13 @@ partial class Build
1823
{
1924
DotNetRestore(x => x.SetProjectFile(Solution));
2025
});
26+
27+
Target Solution_Build => _ => _
28+
.DependsOn(Solution_Restore)
29+
.Executes(() =>
30+
{
31+
// build all projects except 'Builder.Shared'
32+
foreach (var project in Solution.AllProjects.Where(x => !x.Name.Equals("Builder.Shared", StringComparison.Ordinal)))
33+
DotNetBuild(x => x.SetProjectFile(project));
34+
});
2135
}
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ------------------------------------------------------------------------------
2+
# <auto-generated>
3+
#
4+
# This code was generated.
5+
#
6+
# - To turn off auto-generation set:
7+
#
8+
# [GitHubActions (AutoGenerate = false)]
9+
#
10+
# - To trigger manual generation invoke:
11+
#
12+
# nuke --generate-configuration GitHubActions_cd-publish-extension --host GitHubActions
13+
#
14+
# </auto-generated>
15+
# ------------------------------------------------------------------------------
16+
17+
name: cd-publish-extension
18+
19+
on:
20+
workflow_dispatch:
21+
inputs:
22+
ExtensionLibVersion:
23+
description: "Extension Lib Version"
24+
required: false
25+
ExtensionName:
26+
description: "Extension Name"
27+
required: true
28+
29+
jobs:
30+
windows-latest:
31+
name: windows-latest
32+
runs-on: windows-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
.nuke/temp
40+
~/.nuget/packages
41+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
42+
- name: 'Run: Extension_Push'
43+
run: ./build.cmd Extension_Push
44+
env:
45+
ExtensionLibVersion: ${{ github.event.inputs.ExtensionLibVersion }}
46+
ExtensionName: ${{ github.event.inputs.ExtensionName }}
47+
NUGET_PUSH_SHARED: ${{ secrets.NUGET_PUSH_SHARED }}
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ------------------------------------------------------------------------------
2+
# <auto-generated>
3+
#
4+
# This code was generated.
5+
#
6+
# - To turn off auto-generation set:
7+
#
8+
# [GitHubActions (AutoGenerate = false)]
9+
#
10+
# - To trigger manual generation invoke:
11+
#
12+
# nuke --generate-configuration GitHubActions_cd-publish-shared --host GitHubActions
13+
#
14+
# </auto-generated>
15+
# ------------------------------------------------------------------------------
16+
17+
name: cd-publish-shared
18+
19+
on:
20+
workflow_dispatch:
21+
inputs:
22+
SharedLibVersion:
23+
description: "Shared Lib Version"
24+
required: false
25+
26+
jobs:
27+
windows-latest:
28+
name: windows-latest
29+
runs-on: windows-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
.nuke/temp
37+
~/.nuget/packages
38+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
39+
- name: 'Run: Shared_Push'
40+
run: ./build.cmd Shared_Push
41+
env:
42+
SharedLibVersion: ${{ github.event.inputs.SharedLibVersion }}
43+
NUGET_PUSH_SHARED: ${{ secrets.NUGET_PUSH_SHARED }}

.github/workflows/pr-validation.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# ------------------------------------------------------------------------------
2+
# <auto-generated>
3+
#
4+
# This code was generated.
5+
#
6+
# - To turn off auto-generation set:
7+
#
8+
# [GitHubActions (AutoGenerate = false)]
9+
#
10+
# - To trigger manual generation invoke:
11+
#
12+
# nuke --generate-configuration GitHubActions_pr-validation --host GitHubActions
13+
#
14+
# </auto-generated>
15+
# ------------------------------------------------------------------------------
16+
17+
name: pr-validation
18+
19+
on:
20+
pull_request:
21+
branches:
22+
- master
23+
24+
jobs:
25+
ubuntu-latest:
26+
name: ubuntu-latest
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
.nuke/temp
35+
~/.nuget/packages
36+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
37+
- name: 'Run: Solution_Build'
38+
run: ./build.cmd Solution_Build

0 commit comments

Comments
 (0)