Skip to content

Add a tag-driven release workflow with a dry-run mode - #33

Merged
christaylorcodes merged 2 commits into
masterfrom
ci/release-workflow
Nov 11, 2026
Merged

christaylorcodes merged 2 commits into
masterfrom
ci/release-workflow

Conversation

@christaylorcodes

@christaylorcodes christaylorcodes commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Adds a release workflow so a version is published by pushing a tag, with the owner approving the publish step.

Merging this publishes nothing. The workflow only runs on a v* tag or a manual run, and a manual run is always a dry run.

What a release does

Push a tag v<ModuleVersion> on a commit that is on master:

  1. Check (Build/Get-ReleaseInfo.ps1): fails before building unless the tag equals ModuleVersion in the manifest, CHANGELOG.md has a dated section for the version, the version is not on the Gallery yet, and the commit is on master. If the Gallery cannot be reached, the check fails.
  2. Build and test: ./Tests/test-local.ps1, every stage, the same checks as CI on PowerShell 7 and Windows PowerShell 5.1.
  3. Package check (Build/Test-ReleasePackage.ps1): packs the build into a .nupkg, pushes it to a temporary folder repository with Publish-PSResource -NupkgPath, saves the package and imports it on both editions (version, function count, no import warnings).
  4. Publish: Publish-PSResource -NupkgPath of that exact .nupkg, after comparing its SHA256 with the one the build job recorded. Runs in the psgallery environment, which holds PSGALLERY_API_KEY. This job does not check out the repository.
  5. GitHub Release: created for the tag, with the CHANGELOG section as its notes. Only this job has contents: write.

Run workflow (manual) does steps 1 to 3 and stops. In a dry run the notes may come from [Unreleased], and a version that is already on the Gallery is a warning, not a failure. Dry runs and tag runs use separate concurrency groups, so a dry run cannot cancel a waiting release.

Setup (done)

  • Environment psgallery: the owner is the required reviewer and deployments are limited to tags matching v*.
  • Environment secret PSGALLERY_API_KEY: a Gallery key scoped to ConnectWiseControlAPI, "Push new package versions" only.

Files

  • .github/workflows/release.yml: the workflow. Actions are pinned to the same commits as ci.yml.
  • Build/Get-ReleaseInfo.ps1, Build/Test-ReleasePackage.ps1: the checks, runnable locally.
  • Tests/Release.Tests.ps1: 21 tests for the release check (tag and version mismatch, missing or undated CHANGELOG section, dry-run fallback, Gallery answers).
  • AGENTS.md: new "Releasing" section replaces the manual Publish-Module instructions. CHANGELOG.md and a comment in ci.yml updated.

Review

A code review (rule compliance, docs accuracy, bug scan, security and logic) found no bugs and no security problems. Its five smaller findings are fixed in the second commit:

  • five lines over 120 characters
  • the Gallery check treated "no answer" as "not published"
  • a dry run could cancel a queued release
  • dry runs failed once the version was on the Gallery
  • the publish job repackaged the tested files instead of publishing the tested .nupkg

Testing

  • ./Tests/test-local.ps1: all stages pass; 477 tests pass on both editions (25 live tests skip without a server).
  • ./Build/Get-ReleaseInfo.ps1 -AllowUnreleased passes against the real Gallery (0.5.0 is not published); with -Tag v0.5.0 it fails as intended, because the CHANGELOG has no [0.5.0] section yet.
  • ./Build/Test-ReleasePackage.ps1 passes locally: 0.5.0, 32 functions, no aliases or warnings on both editions.
  • The workflow itself has not run yet: GitHub only allows a manual run once the file is on master. The dry run is the first step after this merges.

🤖 Generated with Claude Code

christaylorcodes and others added 2 commits November 10, 2026 19:27
release.yml checks the tag against the manifest and CHANGELOG, builds,
runs every test stage, checks the package installs on both editions,
publishes to the PowerShell Gallery from the psgallery environment and
creates the GitHub Release. A manual run publishes nothing.

Co-Authored-By: Claude <noreply@anthropic.com>
- Publish the .nupkg the package check tested, after comparing its hash
- Gallery check fails when the Gallery cannot be reached; a dry run only
  warns when the version is already published
- Separate concurrency groups so a dry run cannot cancel a queued release
- Wrap lines over 120 characters

Co-Authored-By: Claude <noreply@anthropic.com>
@christaylorcodes
christaylorcodes merged commit 54bf7d0 into master Nov 11, 2026
10 of 11 checks passed
@christaylorcodes
christaylorcodes deleted the ci/release-workflow branch November 12, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant