diff --git a/.github/workflows/build-docker-task.yml b/.github/workflows/build-docker-task.yml index 1a8f35eb..d2e22676 100644 --- a/.github/workflows/build-docker-task.yml +++ b/.github/workflows/build-docker-task.yml @@ -33,7 +33,6 @@ jobs: secrets: inherit with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} build-docker: name: Build Docker image job diff --git a/.github/workflows/build-executable-task.yml b/.github/workflows/build-executable-task.yml index d5e43d7a..ab5add7e 100644 --- a/.github/workflows/build-executable-task.yml +++ b/.github/workflows/build-executable-task.yml @@ -28,7 +28,6 @@ jobs: secrets: inherit with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} build-executable-matrix: name: Build executable project matrix job diff --git a/.github/workflows/build-nugetlibrary-task.yml b/.github/workflows/build-nugetlibrary-task.yml index 07cd46a2..a0311beb 100644 --- a/.github/workflows/build-nugetlibrary-task.yml +++ b/.github/workflows/build-nugetlibrary-task.yml @@ -32,7 +32,6 @@ jobs: uses: ./.github/workflows/get-version-task.yml with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} build-nugetlibrary: name: Build NuGet library project job diff --git a/.github/workflows/build-pypilibrary-task.yml b/.github/workflows/build-pypilibrary-task.yml index c79a67ca..61885a54 100644 --- a/.github/workflows/build-pypilibrary-task.yml +++ b/.github/workflows/build-pypilibrary-task.yml @@ -36,7 +36,6 @@ jobs: uses: ./.github/workflows/get-version-task.yml with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} build-pypilibrary: name: Build PyPI library project job diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index 63e46bdc..4333a42d 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -67,7 +67,6 @@ jobs: secrets: inherit with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} # Entry gate: validate branch<->version consistency once, before the build jobs, so an NBGV mis-classification fails # fast instead of after building and publishing. main must be a public release (no prerelease '-'); every other branch diff --git a/.github/workflows/get-version-task.yml b/.github/workflows/get-version-task.yml index 36fc28b9..d795213d 100644 --- a/.github/workflows/get-version-task.yml +++ b/.github/workflows/get-version-task.yml @@ -9,12 +9,6 @@ on: required: false type: string default: '' - # Logical branch NBGV classifies against. Pins PublicRelease to this branch instead of the runner's GITHUB_REF, - # which on a publish dispatched from the default branch is that branch for every matrix leg. Empty keeps GITHUB_REF. - branch: - required: false - type: string - default: '' outputs: SemVer2: value: ${{ jobs.get-version.outputs.SemVer2 }} @@ -59,7 +53,8 @@ jobs: id: nbgv uses: dotnet/nbgv@master env: - # NBGV reads the branch from GITHUB_REF; pin it to the leg being versioned so a publish dispatched from the - # default branch doesn't classify every leg as the public ref and strip its prerelease suffix. - GITHUB_REF: ${{ inputs.branch != '' && format('refs/heads/{0}', inputs.branch) || github.ref }} - GITHUB_REF_NAME: ${{ inputs.branch != '' && inputs.branch || github.ref_name }} + # Version from the checked-out branch, not the CI ref. GITHUB_REF is reserved and a step env can't reliably + # override it (the runner re-injects the dispatch ref), so on a publish dispatched from the default branch NBGV + # would classify every leg as the public ref. IGNORE_GITHUB_REF makes NBGV ignore GITHUB_REF and use the + # checked-out branch, which each matrix leg already is. The validate-release gate backstops any misclassification. + IGNORE_GITHUB_REF: "true"