18
SSG Release
The last piece of puzzle of Static Site Generator(ssg) development of previous 12 weeks task is releasing application. The most functionalities of SSG has been done successfully. Now it is time to release my application via package manager.
NuGet is a free open source package manager program released by Microsoft as a visual studio development extension. The releasing application is very simple. Generate .nupkg
file and upload this file on NuGet website! Here is following steps for releasing my application:
- Configure
<propertyGroup>
project file (.csproj)
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>kimchi_ssg</RootNamespace>
<PackAsTool>true</PackAsTool>
<PackageId>Kimchi-ssg</PackageId>
<Version>1.0.1</Version>
<Authors>Minsu Kim</Authors>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Simple .NET application to generate static HTML file(s) from text and MarkDown</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/mkim219/kimchi-ssg</PackageProjectUrl>
</PropertyGroup>
If Visual Studio does not generate .nupkg
file, <IsPackable>true</IsPackable>
is required to generate .nupkg
file
-
There is two ways to generate
.nupkg
file-
Build > Pack {Your application}
on Visual Studio - Enter
dotnet pack {C# project file}
in CLI. More detail please refer this page https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
-
On the CLI, the successful message indicates the path where the
.nupkg
file is createdGo to Nuget and create account
Go to Nuget Upload after login
Upload
.nupkg
!
Next step is creating GitHub Action for automating release. First, go to NuGet website for generating API key. Once I have API key, I create secret environment key in setting > secrets > add new repository secret
that I can use in CI.
I found very useful publish template for C#. https://github.com/marketplace/actions/publish-nuget. This template provides a action to build, pack and publish packages automatically when a project version is released. The following code is added on existing .yml
file
- name: publish on version change
id: publish_nuget
uses: rohith/publish-nuget@v2
with:
PROJECT_FILE_PATH: ./kimchi-ssg/kimchi-ssg.csproj
PACKAGE_NAME: Kimchi-ssg
VERSION_REGEX: '^\s*<Version>(.*)<\/Version>\s*$'
NUGET_KEY: ${{secrets.KIMCHI_SSG_NUGET_KEY}}
When GitHub action detects version updating on C# project file. The NuGet Package version is automatically updated.
After I have released my package via NuGet, I have changed to review with my friend who is working on IT company as developer. I found some error that the path environment is different than Window because he uses Linux. Also, he gave me a advise that my README.md
is unclear and vague. I have fixed the issue that happen in the Linux environment and README.md
to make more understandable to reader.
My first release is here. Go to NuGet Console and enter dotnet tool install --global Kimchi-ssg --version 1.0.3
.
18