Files
UA-.NETStandard/tests
romanett a430239fde Allow release.yml to promote release-line previews to nuget.org (#4574)
# Description

Adds a way to publish a numbered release-line preview (e.g.
`2.0.0-preview.6`) to nuget.org.

Since #4513, `nuget-publish.yml` pushes previews only to GitHub
Packages, and `release.yml` (the only nuget.org path) refused every
non-stable candidate. That left no way to continue the `2.0.0-preview.N`
series on nuget.org (last published there: `2.0.0-preview.5`).

## Changes

- **`release.yml`** gains a `channel` input (`stable` | `preview`,
default `stable`).
  - `stable` behaves exactly as before.
- `preview` accepts only a public release-line preview,
`M.m.p-preview.N` with no commit id, from the matching canonical
`release/M.m` branch. `master` / PR builds (`-preview.N.g<sha>`) are
rejected.
- The candidate manifest's recorded `channel` must equal the dispatched
one, so a stable promotion can never publish a preview by accident, or
the reverse.
- **`package-version-policy.ps1`**: new
`Test-PromotablePreviewPackageVersion`, and an `-AllowPreview` switch on
`Test-CanonicalReleaseBranchForPackageVersion`. Callers without the
switch (the stable gate in `nuget-publish.yml`) behave exactly as
before.
- **`docs/ReleaseProcess.md`**: new "Preview release" procedure,
including how to pick the preview number with `versionHeightOffset`.
- **Tests**: predicate cases, the `-AllowPreview` switch, and a pin that
`release.yml` defaults to `stable` and relaxes the gate only for
`channel=preview`.

## GitHub Packages preview feed is unchanged

- `nuget-publish.yml` is not touched. `master` keeps auto-publishing
`2.0.0-preview.<height>.g<sha>` to GitHub Packages, and release-branch
builds keep pushing their own `<base>-preview.N` there.
- The commit-id suffix means `master` versions can never collide with a
bare `2.0.0-preview.N`.
- For a preview, `release.yml`'s GitHub Packages push is a verified
no-op. The candidate's own `nuget-publish.yml` run already pushed those
bytes, and the existing identity preflight and post-push check prove
they match.

## Getting `2.0.0-preview.6` after merge

1. Cut `release/2.0` from `master` after this merges. `release.yml`
executes the policy script from the candidate commit, so that commit
must contain this change.
2. On `release/2.0`, commit a `versionHeightOffset` so the build lands
on `.6`. Verified locally with nbgv 3.10.94: at the current `master` tip
(height 24), one commit setting `-19` yields `2.0.0-preview.6` and the
next yields `.7`. Recompute for the actual cut point with `nbgv
get-version -v NuGetPackageVersion`.
3. Dispatch `release.yml --ref release/2.0 -f release_run_id=<run> -f
channel=preview`, with a dry run first.

`2.0.0-preview.6` is currently free: nuget.org has `.2`–`.5`, and the
retired `release/2.0.0` pushed up to `.5` to GitHub Packages.

## Related Issues

- Follow-up to #4513. Supersedes the `master` → `release/2.0.0` merge
attempts #4566 / #4570; `release/2.0.0` is retired and cannot publish.

## Checklist

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [ ] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

Locally: `PackageVersionPolicyTests` + `NuGetPackageSetValidationTests`
on net10.0, 96/96 passed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 07:45:30 +02:00
..