Skip to content

Commit 16025ef

Browse files
Update GHA CI workflow to publish build artifacts
1 parent 4057e09 commit 16025ef

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
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
name: ${{ matrix.job.os }}
3233
runs-on: ${{ matrix.job.os }}
3334
steps:
@@ -46,3 +47,10 @@ jobs:
4647
fetch-depth: 0
4748
- name: Build
4849
run: ${{ matrix.job.build }} --verbosity=diagnostic --target=pack
50+
- name: Publish artifacts
51+
if: matrix.job.push && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
52+
uses: actions/upload-artifact@v2.2.4
53+
with:
54+
if-no-files-found: warn
55+
name: package
56+
path: artifact/nuget/**/*

.gitignore

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

2626
#cake
2727
.cake/
28-
/artifacts/*
29-
/test/**/tools/*
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-
CleanDirectory("./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)