Build and Push SanjelData NuGet Packages Workflow - CassiniLaw/KnowledgeBase GitHub Wiki
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
There are 2 ways to push the nuget packages:
-
The workflow is triggered on pull requests targeting the
nuget/**
branchesPlease 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
-
- Source code from pull request branch.
- It uses Sanjel's NuGet source.
- It uses secrets.GITHUB_TOKEN to authenticate NuGet server
The workflow assumes the following environment
-
.NET 6.0 SDK
-
NuGet CLI
-
All Projects (Packages) generated must be associated to eServiceMDM repository and give permissions so the package generated here can be pushed.
-
Github Sanjel NuGet packages source [Link 🔗] (https://nuget.pkg.github.com/Sanjel-Energy-Services/index.json)
- Restore NuGet packages
- Build solution in Release configuration
- Pack projects into NuGet packages in
Lib
folder - Publish
.nupkg
and.snupkg
packages to GitHub Packages- Use GitHub token for authentication
- Skip existing packages
- Log results to
push.log
Please review build logs appended to workflow summary to determine if packages generated and pushed were correct.
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.