Add automatic versioning to Connected.Host

Add automatic nuget build to Connected.Host
Build Connected.Host as nuget tool
features/nuget_autobuild
Matija Koželj 2 years ago
parent 28b9c4c79e
commit 3e01ffbe51

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="%PACKAGEHOME%/External" />
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
<add key="Local repository" value="%LOCAL_NUGET%" />
</packageSources>
<disabledPackageSources />
</configuration>

@ -1,9 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PackAsTool>true</PackAsTool>
<IsPackable>true</IsPackable>
<ToolCommandName>connected</ToolCommandName>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>$(AssemblyName)</Title>
<Authors>Tom PIT ltd</Authors>
<Copyright>2022 Tom PIT ltd</Copyright>
<PackageProjectUrl>https://git.tompit.com/Connected/Info</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>connected;platform;</PackageTags>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageOutputPath>$(OutputPath)</PackageOutputPath>
</PropertyGroup>
<ItemGroup>
@ -15,4 +29,25 @@
<PackageReference Include="Microsoft.SqlServer.Management.SqlParser" Version="160.22515.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning"
Version="3.5.119"
PrivateAssets="all"
Condition="!Exists('packages.config')" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<Target Name="CopyPackages" AfterTargets="Pack">
<Copy SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg" DestinationFolder="$([System.Environment]::GetEnvironmentVariable('LOCAL_NUGET'))" />
<Copy SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).snupkg" DestinationFolder="$([System.Environment]::GetEnvironmentVariable('LOCAL_NUGET'))" />
</Target>
</Project>

@ -1,3 +1,4 @@
using System.Reflection;
using Connected.Host.Configuration;
namespace Connected.Host
@ -10,7 +11,7 @@ namespace Connected.Host
.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((_, cfg) =>
{
var appPath = AppContext.BaseDirectory;
var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var segments = new Uri(appPath).Segments;
segments = segments.Select(e => e.Replace("%20", " ")).ToArray();

@ -0,0 +1,14 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0-prerelease",
"semVer1NumericIdentifierPadding": 4,
"nugetPackageVersion": {
"semVer": 2, // optional. Set to either 1 or 2 to control how the NuGet package version string is generated. Default is 1.
"precision": "build" // optional. Use when you want to use a more or less precise package version than the default major.minor.build.
},
"cloudBuild": {
"buildNumber": {
"enabled": true
}
}
}
Loading…
Cancel
Save