Skip to content

Publisher: skip duplicate GitHub release on no-op weeks and pin release tag to the built commit SHA #407

Closed

Description

@ptr727

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

🤖 Filed by Claude Code during the ProjectTemplate two-phase CI/CD work.

Activity

  1. added a commit that references this issue on Jun 4, 2026
    d70b076
  2. added a commit that references this issue on Jun 4, 2026
    5f1eb38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions