The CLOOPS NATS SDK uses a fully automated CI/CD pipeline for version management and NuGet package publishing. This document outlines the release workflow, versioning strategy, and troubleshooting procedures.
The release process is designed to be hands-off and reliable, automatically handling versioning, building, testing, and publishing whenever code changes are pushed to the main branch. The workflow is implemented using GitHub Actions and runs automatically on every push to main.
Releases are automatically triggered when: Code is pushed to main branch - Primary release trigger
The workflow consists of two jobs:
- Build Job: Builds the project, runs tests, and validates the code
- Publish Job: Creates NuGet package, publishes to NuGet.org, creates GitHub tag, and creates GitHub release
graph LR
A[Push to Main] --> B[Trigger GitHub Actions]
B --> C[Calculate Version]
C --> D[Build & Test Job]
D --> E{Tests Pass?}
E -->|Yes| F[Publish Job]
E -->|No| G[Pipeline Fails]
F --> H[Pack NuGet]
H --> I[Publish to NuGet.org]
I --> J[Create GitHub Tag]
J --> K[Create GitHub Release]
K --> L[Release Complete]
Version management is completely controlled by GitHub Actions workflow environment variables defined in .github/workflows/ci.yml.
The version follows the semantic versioning pattern: MAJOR.MINOR.BUILD
Where:
- MAJOR: Defined in workflow env as
MAJOR(currently1) - MINOR: Defined in workflow env as
MINOR(currently1) - BUILD: Automatically set to
github.run_number(GitHub Actions run number)
Example: If MAJOR=1, MINOR=1, and the workflow run number is 42, the resulting version will be 1.1.42.
| Component | Description | Management |
|---|---|---|
| Major | Major version number | Manual update in .github/workflows/ci.yml env section |
| Minor | Minor version number | Manual update in .github/workflows/ci.yml env section |
| Build | GitHub Actions run number | Automatic (increments with each workflow run) |
To update the major or minor version:
- Edit
.github/workflows/ci.yml - Update the
MAJORorMINORvalues in theenvsection (lines 11-12) - Commit and push to
main - The next workflow run will use the new version numbers
As a philosophy, all events, messages and subjects are always backward compatible. A new SDK version always *adds** new events, messages never modifies existing events and messages, unless deprecation is authorized confirming absolutely no one is using old payload
- Package ID:
cloops.nats - Target Framework: .NET 9.0+
- Dependencies: Automatically managed via .csproj files
- Package Repository: NuGet.org (public feed)
- API Key: Stored as GitHub secret
NUGET_API_KEY
The publish job automatically:
- Calculates the package version using the workflow's version strategy
- Builds the project in Release configuration
- Creates the NuGet package (
.nupkgfile) - Uploads the package as a build artifact
- Publishes to NuGet.org using the stored API key
- Skips duplicate packages if the same version already exists
Each published package includes:
- SDK Libraries: Compiled .NET assemblies
- XML Documentation: IntelliSense support for consumers
- Dependencies: Referenced packages and versions
- Metadata: Package description, authors, license information
After successfully publishing to NuGet, the workflow automatically:
- Creates a Git tag in the format
v{version}(e.g.,v1.1.42) - Tags the commit that triggered the workflow
- Skips tag creation if the tag already exists (idempotent)
The workflow also automatically creates a GitHub Release:
- Tag: Uses the version tag created above
- Title:
Release v{version} - Body: Includes version, build number, and commit SHA
- Status: Published (not draft or prerelease)
- Idempotent: Skips creation if release already exists
The release notes are automatically generated and include:
- Version number
- Build number (GitHub Actions run number)
- Commit SHA that triggered the release
Since all versions are backward compatible, consumers should always stay on latest version of SDK.