SSG Release

Introduction

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 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:

  1. 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

  1. There is two ways to generate .nupkg file

  2. On the CLI, the successful message indicates the path where the .nupkg file is created

  3. Go to Nuget and create account

  4. Go to Nuget Upload after login

  5. Upload .nupkg!

GitHub Action

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.

Feedback

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.

Release

My first release is here. Go to NuGet Console and enter dotnet tool install --global Kimchi-ssg --version 1.0.3.

21