mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-14 13:35:38 +00:00
[PR #1095] Add GitHub Actions workflow for automated NuGet releases with multi-platform builds #1525
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1095
State: closed
Merged: Yes
Implements automated NuGet publishing for the
masterandreleasebranches with automatic version detection and prerelease support. The workflow runs on both Windows and Ubuntu for comprehensive testing, with NuGet publishing only on Windows. All version detection, file updates, and publishing logic is implemented in C# in the build project. GitHub releases are created manually.Workflow Behavior
Version Detection (C# implementation):
{NEXT_MINOR_VERSION}-beta.{COMMIT_COUNT}Pipeline:
masterandreleasebranch pushesMAJOR.MINOR.PATCH)SharpCompress.csprojusing C# build targetNUGET_API_KEYsecret (Windows only)--skip-duplicatefor idempotencyImplementation
All logic is implemented in C# as build targets in
build/Program.cs:determine-version- Detects version from git tags, increments minor version for prereleases, and outputs to GitHub Actionsupdate-version- Updates VersionPrefix, AssemblyVersion, and FileVersion in project filepush-to-nuget- Publishes packages to NuGet.orgThe workflow calls these C# targets instead of using bash scripts. Cross-platform compatible (Windows/Linux). Matrix builds ensure cross-platform compatibility while keeping NuGet publishing exclusive to Windows to prevent duplicate publishes.
Example Usage
Setup Required
Add
NUGET_API_KEYsecret to repository settings with NuGet.org API key.Files Added/Modified
.github/workflows/nuget-release.yml- Multi-platform workflow with matrix strategy calling C# build targets, triggers on branch and tag pushes.github/workflows/NUGET_RELEASE.md- Setup and usage documentation with build targets info.github/workflows/TESTING.md- Testing proceduresbuild/Program.cs- Added 3 new build targets with version detection and publishing logic.gitignore- Addedartifacts/directoryOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.