Repository navigation
Description
While adopting the two-phase CI/CD pattern into ProjectTemplate (ptr727/ProjectTemplate#97 → #98), a Copilot review surfaced two robustness issues in the GitHub-release step of publish-release.yml that also appear to apply to NxWitness (the source of the pattern). Filing here so we can back-port if they hold. Neither blocks anything today; both are weekly-publisher edge cases.
1. No-op weekly run re-publishes a duplicate GitHub release
publish-release.yml runs on a weekly schedule and pins the release version to main via NBGV. On a week where main has no new commits since the last run, NBGV produces the same SemVer2, so softprops/action-gh-release is asked to create a release/tag that already exists. Docker tag pushes and (where present) --skip-duplicate/skip-existing handle this gracefully, but the GitHub release step has no such guard — at best it churns the release every week, at worst it can fail re-uploading existing assets, and a failure there can fail the publish run.
Fix applied in ProjectTemplate: a step that checks gh release view "$SemVer2" and gates the softprops step on the release not already existing, so a no-op week is a true no-op for the GitHub release (consistent with NuGet --skip-duplicate / PyPI skip-existing). Docker mutable tags + base-image refresh still happen, so security-only rebuilds still ship.
2. Release tag pinned to a moving ref (target_commitish: main)
The release step uses target_commitish: main — a moving ref. If a commit lands on main while the workflow is running, the tag is created on a newer commit than the one that was checked out and built, so the release's "Browse files" commit won't match the uploaded artifacts.
Fix applied in ProjectTemplate: pin target_commitish to the exact commit NBGV versioned — NBGV exposes a GitCommitId output (surfaced from the get-version task). That SHA is immutable, on the right branch, and consistent with both the SemVer2 tag and the built artifacts. (Note: ProjectTemplate also needed this because its publisher is a branch matrix where github.sha is wrong for the develop leg; NxWitness builds main/develop as separate jobs, but the moving-ref race is the same.)
Reference
- ProjectTemplate implementation: Adopt two-phase CI/CD with PR smoke builds and opt-in publish ProjectTemplate#98 (see
.github/workflows/build-release-task.ymlgithub-releasejob andget-version-task.ymlGitCommitIdoutput). - These were two of several review findings; the rest (cache-to gated on push, global publish concurrency) NxWitness already does correctly, so they don't need back-porting.
🤖 Filed by Claude Code during the ProjectTemplate two-phase CI/CD work.
Activity
Skip duplicate GitHub release and pin tag to built commit SHA (#408)
Skip duplicate GitHub release and pin tag to built commit SHA (#411)