dotnet/nbgv

Question regarding PublicRelease

fabich opened this issue · 2 comments

Hi

I'm triggering a GitHub Action in a remote repository.
This remote action is checking out source code from another repo.
When running aarnott/nbgv@v0.3 PublicRelease is always set to True.
However, the branch I have checked out is not the master branch.

Relevant part of my GitHub Action:

name: Create and save OpenAPI specification files

on:
  repository_dispatch:
    types: [Generate-OpenAPI-Specification]

jobs:
  create-files:
    name: Create OpenAPI specification files
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.set-version.outputs.version }}
      build: ${{ steps.set-build.outputs.build }}
    steps:
      - name: Event Information
        run: |
          echo "Event: ${{ github.event.action }}"
          echo "Repository: ${{ github.event.client_payload.repository }}"
          echo "Ref: ${{ github.event.client_payload.ref }}"
          echo "Build: ${{ github.event.client_payload.build }}"
      - uses: actions/setup-dotnet@v1
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.client_payload.ref }}
          repository: ${{ github.event.client_payload.repository }}
          token: ${{ secrets.GH_REPOS }} # `GitHub_PAT` is a secret that contains your PAT
          path: myPath
          fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
      - name: Create Result Directory
        run: mkdir src
      - name: Read version
        uses: aarnott/nbgv@v0.3
        with:
          path: myPath
        id: read-version
      - run: nbgv get-version
        working-directory: ./myPath

My version.json:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.10.1-preview.{height}",
  "nuGetPackageVersion": {
    "semVer": 2.0
  },
  "publicReleaseRefSpec": [
    "^refs/heads/master$",
    "^refs/heads/v\\d+(?:\\.\\d+)?$"
  ],
  "release": {
    "branchName": "release/v{version}",
    "versionIncrement": "build",
    "firstUnstableTag": "preview"
  }
}

Expected values:
"SemVer2": "1.10.1-preview.38-92b2c0ac52"
"PublicRelease": false

Actual values:
"SemVer2": "1.10.1-preview.38"
"PublicRelease": true,

Am I missing something?
Is there a way to forcefully set PublicRelease to false?

You mentioned it isn't building master, but what is the branch name you're building above? I see two regex patterns that are interpreted as public release branches (e.g. v1.2 would also build as public release).

Looking at other github action runs like this one shows that nbgv is recognizing non-public releases. So I'm guessing you were on a branch that met one of the publicReleaseRefSpec regex patterns. BTW, your patterns don't seem to match your intended release/v* pattern from your release.branchName property.