Skip to content

Commit 54cb2c4

Browse files
committed
Provide an easy way to publish packages to a custom feed
1 parent d2703e1 commit 54cb2c4

File tree

5 files changed

+65
-1
lines changed

5 files changed

+65
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ _Build
2626
_Work
2727
.vs
2828
.idea
29+
User.Directory.Build.props

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@
7070
<Exec Command="git rev-parse HEAD > rev.txt" WorkingDirectory="_Build" />
7171
</Target>
7272

73-
73+
<Import Condition="Exists('User.Directory.Build.props')" Project="User.Directory.Build.props" />
7474
</Project>

Orm.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
6969
ProjectSection(SolutionItems) = preProject
7070
.editorconfig = .editorconfig
7171
Directory.Build.props = Directory.Build.props
72+
User.Directory.Build.props.example = User.Directory.Build.props.example
7273
Version.props = Version.props
7374
EndProjectSection
7475
EndProject
7576
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xtensive.Orm.Weaver", "Weaver\Xtensive.Orm.Weaver\Xtensive.Orm.Weaver.csproj", "{75B3DB45-3055-4A22-854A-BD271D5E4218}"
7677
EndProject
7778
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xtensive.Orm.SqlServer", "Orm\Xtensive.Orm.SqlServer\Xtensive.Orm.SqlServer.csproj", "{45000ADE-F647-4171-A91A-428CDF682603}"
7879
EndProject
80+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Publish", ".Publish", "{5726BBD8-14F9-4909-B765-3E7709223B61}"
81+
EndProject
82+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetPublish", "Publish\NuGetPublish.csproj", "{2CC55F3E-8EA5-4305-8716-D5B944120F82}"
83+
EndProject
7984
Global
8085
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8186
Debug|Any CPU = Debug|Any CPU
@@ -198,6 +203,8 @@ Global
198203
{45000ADE-F647-4171-A91A-428CDF682603}.Debug|Any CPU.Build.0 = Debug|Any CPU
199204
{45000ADE-F647-4171-A91A-428CDF682603}.Release|Any CPU.ActiveCfg = Release|Any CPU
200205
{45000ADE-F647-4171-A91A-428CDF682603}.Release|Any CPU.Build.0 = Release|Any CPU
206+
{2CC55F3E-8EA5-4305-8716-D5B944120F82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
207+
{2CC55F3E-8EA5-4305-8716-D5B944120F82}.Release|Any CPU.ActiveCfg = Release|Any CPU
201208
EndGlobalSection
202209
GlobalSection(SolutionProperties) = preSolution
203210
HideSolutionNode = FALSE
@@ -231,6 +238,7 @@ Global
231238
{3AC7C076-26BA-4185-A0FC-2B97D7AF48D9} = {DC441957-AF79-423D-AA60-2F102926F6D2}
232239
{15CC7358-3A5B-4146-A5CB-78DAE75E88E6} = {DC441957-AF79-423D-AA60-2F102926F6D2}
233240
{45000ADE-F647-4171-A91A-428CDF682603} = {2302847B-292A-4650-A852-BDED40E1BB1C}
241+
{2CC55F3E-8EA5-4305-8716-D5B944120F82} = {5726BBD8-14F9-4909-B765-3E7709223B61}
234242
EndGlobalSection
235243
GlobalSection(ExtensibilityGlobals) = postSolution
236244
SolutionGuid = {F995719A-8D35-49A3-B271-42898A587F57}

Publish/NuGetPublish.csproj

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<NoBuild>true</NoBuild>
5+
<!-- prevents error `The 'NoBuild' property was set to true but the 'Build' target was invoked` -->
6+
<!-- will be removed after https://github.com/NuGet/Home/issues/7801 in netcore > 5 ? -->
7+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
8+
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
9+
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
10+
<CopyDocumentationFileToOutputDirectory>false</CopyDocumentationFileToOutputDirectory>
11+
<TargetFramework>netstandard2.0</TargetFramework>
12+
<IncludeBuildOutput>false</IncludeBuildOutput>
13+
<PackageId>tmp</PackageId>
14+
<PackageOutputPath>$(BaseIntermediateOutputPath)</PackageOutputPath>
15+
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
16+
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
17+
<RunAnalyzers>false</RunAnalyzers>
18+
<NoPackageAnalysis>true</NoPackageAnalysis>
19+
<WarningLevel>0</WarningLevel>
20+
</PropertyGroup>
21+
<!-- Force Release Configuration build and check env variables / User.Directory.Build.props -->
22+
<Target Name="_CheckConfiguration" BeforeTargets="CoreBuild">
23+
<Error Condition="'$(Configuration)' != 'Release'" Text="You should build this project only in 'Release' configuration. Use `dotnet build -c Release`" />
24+
<Error Condition="'$(DoNugetFeedApiKey)' == ''" Text="You should set 'DoNugetFeedApiKey' property in User.Directory.Build.props or in env variable" />
25+
<Error Condition="'$(DoNugetFeedUrl)' == ''" Text="You should set 'DoNugetFeedUrl' property in User.Directory.Build.props or in env variable" />
26+
</Target>
27+
28+
<ItemGroup Label="Build order">
29+
<ProjectReference Include="$(SolutionDir)\Extensions\**\*.csproj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
30+
<ProjectReference Include="$(SolutionDir)\Orm\**\*.csproj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
31+
<ProjectReference Include="$(SolutionDir)\Weaver\**\*.csproj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
32+
</ItemGroup>
33+
<!-- You can add to this list in User.Directory.Build.props -->
34+
<ItemGroup>
35+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.$(Version).nupkg" />
36+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.BulkOperations.$(Version).nupkg" />
37+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Logging.NLog.$(Version).nupkg" />
38+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Security.$(Version).nupkg" />
39+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.SqlServer.$(Version).nupkg" />
40+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Tracking.$(Version).nupkg" />
41+
</ItemGroup>
42+
43+
<!-- If package-lock.json has changed, perform an NPM install -->
44+
<Target Name="PublishToNuget" AfterTargets="Pack" DependsOnTargets="Pack">
45+
<Message Importance="high" Text="Publish nupkg %(NugetPublishInput.Identity) to server" />
46+
<Exec Command="dotnet nuget push %(NugetPublishInput.Identity) --force-english-output --timeout 60 --api-key $(DoNugetFeedApiKey) --source $(DoNugetFeedUrl)" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
47+
</Target>
48+
</Project>

User.Directory.Build.props.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="latest">
3+
<PropertyGroup Label="User defined variables">
4+
<DoNugetFeedApiKey>Put key Here</DoNugetFeedApiKey>
5+
<DoNugetFeedUrl>Put url here</DoNugetFeedUrl>
6+
</PropertyGroup>
7+
</Project>

0 commit comments

Comments
 (0)