RecordVisitors- NuGet–part 5

Now it the moment to deploy to NuGet. First , we should have automatic build and deploy to NuGet with GitHub Actions.  This is pretty simple –  the yml becomes

    – name: Pack

run: |

        cd src/RecordVisitors/

        # dotnet pwsh setVersion.ps1

        cd RecordVisitors

        dotnet pack -o nugetPackages

    – name: ‘Upload Artifact’

uses: actions/upload-artifact@v2

with:

name: RecordVisitorsNuget_${{github.run_number}}

path: src/RecordVisitors/RecordVisitors/nugetPackages

retention-days: 1

The modifications of the csproj project are the following

<ItemGroup>
     <PackageReference Include=”Microsoft.SourceLink.GitHub” Version=”1.0.0″ PrivateAssets=”All” />
     <None Include=”../../../readme.md” Pack=”true” PackagePath=”\” />
     <None Include=”../../../docs/rv.png” Pack=”true” PackagePath=”\” />
   </ItemGroup>

   <PropertyGroup>
     <Version>2021.5.29.1730</Version>
     <Authors>Andrei Ignat</Authors>
     <Description>This package help you record your visitors</Description>
     <Title>Record Visitors</Title>
     <PackageTags>C#;.NET;ASP.NET Core</PackageTags>
     <PackageReadmeFile>readme.md</PackageReadmeFile>
     <!–<PackageIconUrl>https://github.com/ignatandrei/RecordVisitors/raw/main/docs/rv.png</PackageIconUrl>–>
     <PackageIcon>rv.png</PackageIcon>
     <RepositoryUrl>https://github.com/ignatandrei/RecordVisitors</RepositoryUrl>
     <PackageProjectUrl>https://github.com/ignatandrei/RecordVisitors</PackageProjectUrl>
     <RepositoryType>GIT</RepositoryType>
     <Copyright>MIT</Copyright>
     <PackageLicenseExpression>MIT</PackageLicenseExpression>
     <IncludeSymbols>true</IncludeSymbols>
     <PublishRepositoryUrl>true</PublishRepositoryUrl>
     <EmbedUntrackedSources>true</EmbedUntrackedSources>
     <Deterministic>true</Deterministic>
     <DebugType>embedded</DebugType>

  </PropertyGroup>
   <PropertyGroup Condition=”‘$(GITHUB_ACTIONS)’ == ‘true'”>
     <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
   </PropertyGroup>

If you want more, read https://alex-klaus.com/better-nuget/  and https://docs.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices