Skip to content

Commit 5f578c9

Browse files
authored
Merge pull request #45 from servicetitan/packages-publication
Provide an easy way to publish packages to a custom feed
2 parents 7a53183 + db3ce47 commit 5f578c9

File tree

5 files changed

+74
-1
lines changed

5 files changed

+74
-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
@@ -70,13 +70,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Cfg", ".Cfg", "{C02BF3D5-F
7070
.editorconfig = .editorconfig
7171
.gitignore = .gitignore
7272
Directory.Build.props = Directory.Build.props
73+
User.Directory.Build.props.example = User.Directory.Build.props.example
7374
Version.props = Version.props
7475
EndProjectSection
7576
EndProject
7677
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xtensive.Orm.Weaver", "Weaver\Xtensive.Orm.Weaver\Xtensive.Orm.Weaver.csproj", "{75B3DB45-3055-4A22-854A-BD271D5E4218}"
7778
EndProject
7879
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xtensive.Orm.SqlServer", "Orm\Xtensive.Orm.SqlServer\Xtensive.Orm.SqlServer.csproj", "{45000ADE-F647-4171-A91A-428CDF682603}"
7980
EndProject
81+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Publish", ".Publish", "{5726BBD8-14F9-4909-B765-3E7709223B61}"
82+
EndProject
83+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetPublish", "Publish\NuGetPublish.csproj", "{2CC55F3E-8EA5-4305-8716-D5B944120F82}"
84+
EndProject
8085
Global
8186
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8287
Debug|Any CPU = Debug|Any CPU
@@ -199,6 +204,8 @@ Global
199204
{45000ADE-F647-4171-A91A-428CDF682603}.Debug|Any CPU.Build.0 = Debug|Any CPU
200205
{45000ADE-F647-4171-A91A-428CDF682603}.Release|Any CPU.ActiveCfg = Release|Any CPU
201206
{45000ADE-F647-4171-A91A-428CDF682603}.Release|Any CPU.Build.0 = Release|Any CPU
207+
{2CC55F3E-8EA5-4305-8716-D5B944120F82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
208+
{2CC55F3E-8EA5-4305-8716-D5B944120F82}.Release|Any CPU.ActiveCfg = Release|Any CPU
202209
EndGlobalSection
203210
GlobalSection(SolutionProperties) = preSolution
204211
HideSolutionNode = FALSE
@@ -232,6 +239,7 @@ Global
232239
{3AC7C076-26BA-4185-A0FC-2B97D7AF48D9} = {DC441957-AF79-423D-AA60-2F102926F6D2}
233240
{15CC7358-3A5B-4146-A5CB-78DAE75E88E6} = {DC441957-AF79-423D-AA60-2F102926F6D2}
234241
{45000ADE-F647-4171-A91A-428CDF682603} = {2302847B-292A-4650-A852-BDED40E1BB1C}
242+
{2CC55F3E-8EA5-4305-8716-D5B944120F82} = {5726BBD8-14F9-4909-B765-3E7709223B61}
235243
EndGlobalSection
236244
GlobalSection(ExtensibilityGlobals) = postSolution
237245
SolutionGuid = {F995719A-8D35-49A3-B271-42898A587F57}

Publish/NuGetPublish.csproj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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.Firebird.$(Version).nupkg" />
38+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Localization.$(Version).nupkg" />
39+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Logging.log4net.$(Version).nupkg" />
40+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Logging.NLog.$(Version).nupkg" />
41+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.MySql.$(Version).nupkg" />
42+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Oracle.$(Version).nupkg" />
43+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.PostgreSql.$(Version).nupkg" />
44+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Reprocessing.$(Version).nupkg" />
45+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Security.$(Version).nupkg" />
46+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Sqlite.$(Version).nupkg" />
47+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.SqlServer.$(Version).nupkg" />
48+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Tracking.$(Version).nupkg" />
49+
<NugetPublishInput Include="$(SolutionDir)_Build\Release\packages\Xtensive.Orm.Web.$(Version).nupkg" />
50+
</ItemGroup>
51+
52+
<!-- If package-lock.json has changed, perform an NPM install -->
53+
<Target Name="PublishToNuget" AfterTargets="Pack" DependsOnTargets="Pack">
54+
<Message Importance="high" Text="Publish nupkg %(NugetPublishInput.Identity) to server" />
55+
<Exec Command="dotnet nuget push %(NugetPublishInput.Identity) --force-english-output --timeout 60 --api-key $(DoNugetFeedApiKey) --source $(DoNugetFeedUrl)" WorkingDirectory="$(SolutionDir)_Build\Release\packages" />
56+
</Target>
57+
</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)