Build and Push SanjelData NuGet Packages Workflow - CassiniLaw/KnowledgeBase GitHub Wiki

Build and Push SanjelData NuGet Packages Workflow

Description

The overall workflow enables automated building and publishing of NuGet packages on pull requests. This allows package updates to be tested and released faster.

Packages produced from this workflow will be pushed to Sanjel NuGet registry https://nuget.pkg.github.com/Sanjel-Energy-Services/index.json

Trigger Conditions

There are 2 ways to push the nuget packages:

  • The workflow is triggered on pull requests targeting the nuget/** branches

    Please refer to the official GitHub documentation to create a pull request. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request

    The package version to generate using this method is the version contained in the <version></version> tag in the .csproj project file.

  • When a Tag is pushed using the following format:

    • SanjelDataV[0-9]+.[0-9]+.[0-9]+ for example: SanjelDataV1.0.1 this is going to generate all SanjelData libraries packages using 1.0.1 version.
    • SanjelDataV[0-9]+.[0-9]+.[0-9]+-*[0-9]+ You can also push a non-stable version tag such as SanjelDataV1.0.1-rc1 or SanjelDataV3.0.1-beta5

    Please refer to the official git documentation to create and push a tag: https://git-scm.com/book/en/v2/Git-Basics-Tagging

    git tag -a SanjelDataV1.0.1 -m "feature x"  	#create tag
    
    git push origin SanjelDataV1.0.1  	        #push tag

Inputs

  • Source code from pull request branch.
  • It uses Sanjel's NuGet source.
  • It uses secrets.GITHUB_TOKEN to authenticate NuGet server

Environment Setup

The workflow assumes the following environment

Build Steps

  1. Restore NuGet packages
  2. Build solution in Release configuration
  3. Pack projects into NuGet packages in Lib folder
  4. Publish .nupkg and .snupkg packages to GitHub Packages
    • Use GitHub token for authentication
    • Skip existing packages
    • Log results to push.log

Outputs

Please review build logs appended to workflow summary to determine if packages generated and pushed were correct.

Job Summary

This job builds the projects, generates NuGet packages and publishes them to GitHub Packages whenever there is a pull request to nuget/** branches or a tag SanjelDataVx.x.x or SanjelDataVx.x.x-rc1 push.

The end result is updated packages published to GitHub Packages for consumption in downstream workflows and applications.

⚠️ **GitHub.com Fallback** ⚠️