From 5d47bfaeb6445264ed414ef73ba505c13464bc2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 13:36:19 +0000 Subject: [PATCH] Add tag push trigger to workflow - Workflow now triggers on tag pushes in addition to branch pushes - Tags must match pattern: [0-9]+.[0-9]+.[0-9]+ (e.g., 0.43.0) - Updated documentation to explain both triggering methods - Allows publishing by pushing tags directly without requiring branch push Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com> --- .github/workflows/NUGET_RELEASE.md | 25 ++++++++++++++++++++----- .github/workflows/nuget-release.yml | 2 ++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/NUGET_RELEASE.md b/.github/workflows/NUGET_RELEASE.md index 8fa18710..42375089 100644 --- a/.github/workflows/NUGET_RELEASE.md +++ b/.github/workflows/NUGET_RELEASE.md @@ -4,7 +4,11 @@ This document describes the automated NuGet release workflow for SharpCompress. ## Overview -The `nuget-release.yml` workflow automatically builds, tests, and publishes SharpCompress packages to NuGet.org when changes are pushed to the `master` or `release` branch. The workflow runs on both Windows and Ubuntu, but only the Windows build publishes to NuGet. +The `nuget-release.yml` workflow automatically builds, tests, and publishes SharpCompress packages to NuGet.org when: +- Changes are pushed to the `master` or `release` branch +- A version tag (format: `MAJOR.MINOR.PATCH`) is pushed + +The workflow runs on both Windows and Ubuntu, but only the Windows build publishes to NuGet. ## How It Works @@ -60,16 +64,27 @@ Consider enabling branch protection rules for the `release` branch to ensure: ### Creating a Stable Release -1. Ensure all changes are merged and tested on the `master` or `release` branch +There are two ways to trigger a stable release: + +**Method 1: Push tag to trigger workflow** +1. Ensure all changes are committed on the `master` or `release` branch 2. Create and push a version tag: ```bash git checkout master # or release git tag 0.43.0 git push origin 0.43.0 ``` -3. The workflow will automatically: - - Build and test the project on both Windows and Ubuntu - - Publish `SharpCompress 0.43.0` to NuGet.org (Windows build) +3. The workflow will automatically trigger, build, test, and publish `SharpCompress 0.43.0` to NuGet.org (Windows build) + +**Method 2: Tag after pushing to branch** +1. Ensure all changes are merged and pushed to the `master` or `release` branch +2. Create and push a version tag on the already-pushed commit: + ```bash + git checkout master # or release + git tag 0.43.0 + git push origin 0.43.0 + ``` +3. The workflow will automatically trigger, build, test, and publish `SharpCompress 0.43.0` to NuGet.org (Windows build) ### Creating a Prerelease diff --git a/.github/workflows/nuget-release.yml b/.github/workflows/nuget-release.yml index f1cb8f73..fe7d404a 100644 --- a/.github/workflows/nuget-release.yml +++ b/.github/workflows/nuget-release.yml @@ -5,6 +5,8 @@ on: branches: - 'master' - 'release' + tags: + - '[0-9]+.[0-9]+.[0-9]+' permissions: contents: read