Skip to content

Commit 2022798

Browse files
Push artifacts via GitHub Actions CI workflow
1 parent 0af2549 commit 2022798

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
job:
2929
- os: windows-2019
3030
build: ./build.cmd
31+
push: true
3132
- os: windows-2022
3233
build: ./build.cmd
3334
name: ${{ matrix.job.os }}
@@ -48,3 +49,10 @@ jobs:
4849
fetch-depth: 0
4950
- name: Build
5051
run: ${{ matrix.job.build }} --verbosity=diagnostic --target=pack
52+
- name: Publish artifacts
53+
if: matrix.job.push && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
54+
uses: actions/[email protected]
55+
with:
56+
if-no-files-found: warn
57+
name: package
58+
path: artifact/nuget/**/*

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ Thumbs.db
2525

2626
#cake
2727
.cake/
28-
/artifacts/*
28+
/artifact/*

build.cake

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ var buildVersion = MinVer(s => s.WithTagPrefix("v").WithDefaultPreReleasePhase("
77
Task("clean")
88
.Does(() =>
99
{
10-
CleanDirectories("./artifacts/**");
11-
CleanDirectories("./src/**/bin");
12-
CleanDirectories("./src/**/obj");
13-
CleanDirectories("./test/**/bin");
14-
CleanDirectories("./test/**/obj");
10+
CleanDirectories("./artifact/**");
11+
CleanDirectories("./**/^{bin,obj}");
1512
});
1613

1714
Task("restore")
@@ -33,11 +30,11 @@ Task("build")
3330
Configuration = configuration,
3431
NoRestore = true,
3532
NoIncremental = false,
36-
ArgumentCustomization = args =>
37-
args.AppendQuoted($"-p:Version={buildVersion.Version}")
38-
.AppendQuoted($"-p:AssemblyVersion={buildVersion.FileVersion}")
39-
.AppendQuoted($"-p:FileVersion={buildVersion.FileVersion}")
40-
.AppendQuoted($"-p:ContinuousIntegrationBuild=true")
33+
MSBuildSettings = new DotNetCoreMSBuildSettings()
34+
.WithProperty("Version", buildVersion.Version)
35+
.WithProperty("AssemblyVersion", buildVersion.AssemblyVersion)
36+
.WithProperty("FileVersion", buildVersion.FileVersion)
37+
.WithProperty("ContinuousIntegrationBuild", BuildSystem.IsLocalBuild ? "false" : "true")
4138
});
4239
});
4340

@@ -70,10 +67,10 @@ Task("pack")
7067
Configuration = "Release",
7168
NoRestore = true,
7269
NoBuild = true,
73-
OutputDirectory = "./artifacts/nuget",
74-
ArgumentCustomization = args =>
75-
args.AppendQuoted($"-p:Version={buildVersion.Version}")
76-
.AppendQuoted($"-p:PackageReleaseNotes={releaseNotes}")
70+
OutputDirectory = "./artifact/nuget",
71+
MSBuildSettings = new DotNetCoreMSBuildSettings()
72+
.WithProperty("Version", buildVersion.Version)
73+
.WithProperty("PackageReleaseNotes", releaseNotes)
7774
});
7875
});
7976

@@ -101,7 +98,7 @@ Task("push")
10198
ApiKey = apiKey,
10299
};
103100

104-
foreach (var nugetPackageFile in GetFiles("./artifacts/nuget/*.nupkg"))
101+
foreach (var nugetPackageFile in GetFiles("./artifact/nuget/*.nupkg"))
105102
{
106103
DotNetCoreNuGetPush(nugetPackageFile.FullPath, nugetPushSettings);
107104
}

0 commit comments

Comments
 (0)