dotnet / nbgv Goto Github PK
View Code? Open in Web Editor NEWThe repo behind the dotnet/nbgv GitHub Action
Home Page: https://github.com/dotnet/nerdbank.gitversioning
License: MIT License
The repo behind the dotnet/nbgv GitHub Action
Home Page: https://github.com/dotnet/nerdbank.gitversioning
License: MIT License
@ctaggart: I'm finally in the github actions v2 preview. I pushed to this repo, but the action you defined for this repo did not run. Any ideas why?
The nbgv cloud
command (which this github action basically exposes) takes several optional parameters/switches. These should be made available as github action parameters.
aarnott/nbgv@master GitHub Action was no longer producing the NBGV_SIMPLEVERSION as of a few days ago.
Today, I upgraded to:
- name: Use Nerdbank.GitVersioning to set version variables
uses: aarnott/nbgv@master uses: aarnott/[email protected]
with:
setAllVars: true
This doesn't work either:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: ". Path 'cloudBuild', line 8, position 2.
My version.json file, which hasn't changed looks like:
{
"version": "1.1",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/develop$",
"^refs/heads/rel/v\d+\.\d+"
]
}
Any ideas?
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: ". Path 'cloudBuild', line 8, position 2.
at Newtonsoft.Json.JsonTextReader.ParsePostValue()
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Nerdbank.GitVersioning.VersionFile.TryReadVersionJsonContent(String jsonContent) in D:\a\1\s\src\NerdBank.GitVersioning\VersionFile.cs:line 340
at Nerdbank.GitVersioning.VersionFile.GetVersion(Commit commit, String repoRelativeProjectDirectory) in D:\a\1\s\src\NerdBank.GitVersioning\VersionFile.cs:line 75
at Nerdbank.GitVersioning.GitExtensions.CommitMatchesVersion(Commit commit, SemanticVersion expectedVersion, Position comparisonPrecision, String repoRelativeProjectDirectory) in
D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 450
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 676
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
I switched from GitVersion to GitVersioning and I love it. Thanks for all your work!
I use this GitHub Action snippet
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: aarnott/[email protected] # https://github.com/AArnott/nbgv
id: nbgv
- name: Versioning
run: echo ${{ steps.nbgv.outputs.SemVer2 }}
- name: Build with dotnet
run: dotnet build
--configuration ${{ env.BuildConfig }}
/p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}
- name: Test with dotnet
run: dotnet test
- name: Pack NuGet
run: dotnet pack
--configuration ${{ env.BuildConfig }}
/p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }}
For the NuGet currently it creates for example version 3.2.1
no matter if I am directly on the master or in a pull request. Shouldn't something like 3.2.1-pr<PR Id>.<Build Id>
be created in the Pull Request?
This action currently uses node 12, see https://github.com/dotnet/nbgv/blob/HEAD/action.yml#L84
Node 12 is deprecated on GitHub Actions since 2022-09-22.
When actions workflows that use the nbgv action run, we get the following warning message:
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: dotnet/nbgv
Ok, I'm new to dot net core versioning and github actions - I only tagged packages manually before.
I found nbgv and would like to use it and it's github action. But I am utterly confused at which step I would need to add this action and what I would need to do after adding this action.
Would be totally great if the readme contains some usage instructions for dummies.
I would even be prepared to add a PR, but honestly atm I am lacking a good starting point to bootstrap myself out of confusion.
Hi and thanks for this tool!
https://github.com/marketplace/actions/nerdbank-gitversioning shows 0.3.1 as the latest version.
However If I try to use that I get that add-path error that apparently was fixed in 0.4.0.
It seems that 0.4.0 needs to be published somehow on the GitHub Marketplace?
Error: Unable to process command '::add-path::C:\Users\runneradmin\.dotnet\tools' successfully.
Error: The `add-path` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
The dotnet tool install
step returns a non-zero exit code if the tool is already installed, so it fails on repeated runs or if run after dotnet tool install
already installed nbgv.
We should make this more resilient.
Also, we should consider not installing the tool globally. This is useful if the agent the action runs on is shared or reused across runs. Is that possible? In Azure Pipelines there are "private agents" which make it important for tasks to not change machine-wide state. Is such the case here?
I've been hitting this exception since I upgraded to aarnott/[email protected]
https://github.com/microsoft/github-actions-for-desktop-apps/blob/master/.github/workflows/ci.yml
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at LibGit2Sharp.Core.Proxy.git_commit_tree_id(ObjectHandle obj)
at LibGit2Sharp.Commit.<>c__DisplayClass11_0.<.ctor>b__0(ObjectHandle obj)
at LibGit2Sharp.Core.GitObjectLazyGroup.<>c__DisplayClass3_01.<Singleton>b__0() at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy
1.CreateValue()
at Nerdbank.GitVersioning.VersionFile.GetVersion(Commit commit, String repoRelativeProjectDirectory) in D:\a\1\s\src\NerdBank.GitVersioning\VersionFile.cs:line 52
at Nerdbank.GitVersioning.GitExtensions.CommitMatchesVersion(Commit commit, SemanticVersion expectedVersion, Position comparisonPrecision, String repoRelativeProjectDirectory) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 450
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 676
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func
2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at Nerdbank.GitVersioning.GitExtensions.GetVersionHeight(Commit commit, String repoRelativeProjectDirectory, Version baseVersion) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 65
at Nerdbank.GitVersioning.VersionOracle..ctor(String projectDirectory, Repository repo, Commit head, ICloudBuild cloudBuild, Nullable`1 overrideVersionHeightOffset, String projectPathRelativeToGitRepoRoot) in D:\a\1\s\src\NerdBank.GitVersioning\VersionOracle.cs:line 86
at Nerdbank.GitVersioning.Tool.Program.OnGetVersionCommand(String projectPath, String format, String singleVariable, String versionOrRef) in D:\a\1\s\src\nbgv\Program.cs:line 305
at Nerdbank.GitVersioning.Tool.Program.MainInner(String[] args) in D:\a\1\s\src\nbgv\Program.cs:line 149
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Nerdbank.GitVersioning.Tool.Program.Main(String[] args) in D:\a\1\s\src\nbgv\Program.cs:line 64
##[error]The process 'C:\Users\runneradmin.dotnet\tools\nbgv.exe' failed with exit code 3762504530
Why does the action produce a nbgv.json file?
Is the root directory of the user's source tree the right place to create such a file, or does GitHub Actions define an artifacts directory that would be more appropriate?
Hi,
I use PR comment commands like /publish
with github actions, and as you might know that workflows triggered on issue_comment
started from the default branch (master
in my case), thus the
works wrong.
I have something like this in workflow:
- name: git checkout / on 'workflow_call'
if: ${{ inputs.ref != '' }}
uses: actions/checkout@v3
with:
clean: false
# branch name
ref: ${{ inputs.ref }}
fetch-depth: 0
...
- name: Generate version variables
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
And I can't do something like echo "GITHUB_REF=refs/heads/$branch" >> $GITHUB_ENV
because:
If you attempt to override the value of one of these default environment variables, the assignment is ignored.
So I can't override the wrong GITHUB_REF
value and because of that nbgv step generates wrong version info.
Do you have any ideas how to beat this?
cc: @AArnott
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/[email protected] 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/[email protected]
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?
At the moment getting the following warning when running the task.
Warning: The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
Would like to be able to set the path to the "version.json" file for this tool. Now it doesn't read the "version.json" file we have located in the "build" folder on our project
Originally posted by @fredeil in dotnet/Nerdbank.GitVersioning#377 (comment)
I get the following error when running setup-dotnet before running setup step for aarnott/nbgv@master
in GitHub actions. There is no error if I run setup-NBGV before setup-dotnet.
name: test
env:
CAKE_VERSION: 0.32.1
CAKE_SCRIPT: ./build.cake
DOTNET_VERSION: 3.0.100
DOCKER_REG_USER: ${{ secrets.DOCKER_REG_USER }}
DOCKER_REG_PASS: ${{ secrets.DOCKER_REG_PASS }}
PROJECT_NAME: test
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "${{ env.DOTNET_VERSION }}"
- uses: aarnott/nbgv@master
- run: echo "VERSION= $NBGV_Version"
- name: Chmod executable
run: chmod +x ./build.sh
shell: bash
continue-on-error: true
- name: Build with CAKE
run: ./build.sh --project-name=$PROJECT_NAME --project-version=$NBGV_Version --docker-reg-user=$DOCKER_REG_USER --docker-reg-pass=$DOCKER_REG_PASS
shell: bash
continue-on-error: false
2019-10-15T08:53:47.5407577Z ##[group]Run actions/setup-dotnet@v1
2019-10-15T08:53:47.5407736Z with:
2019-10-15T08:53:47.5407839Z dotnet-version: 3.0.100
2019-10-15T08:53:47.5407939Z env:
2019-10-15T08:53:47.5408040Z CAKE_VERSION: 0.32.1
2019-10-15T08:53:47.5408208Z CAKE_SCRIPT: ./***.cake
2019-10-15T08:53:47.5408318Z DOTNET_VERSION: 3.0.100
2019-10-15T08:53:47.5408767Z ##[endgroup]
2019-10-15T08:53:47.9385785Z [command]/home/runner/work/_actions/actions/setup-dotnet/v1/externals/get-os-distro.sh
2019-10-15T08:53:47.9565988Z Primary:linux-x64
2019-10-15T08:53:47.9567236Z Legacy:ubuntu.16.04
2019-10-15T08:53:47.9570443Z Checking tool cache
2019-10-15T08:53:47.9579530Z Getting a download url 3.0.100
2019-10-15T08:53:48.1209029Z Could not fetch download information for version 3.0.100
2019-10-15T08:53:48.1232375Z [command]/home/runner/work/_actions/actions/setup-dotnet/v1/externals/install-dotnet.sh --version 3.0.100 --dry-run
2019-10-15T08:53:48.1570828Z dotnet-install: Payload URLs:
2019-10-15T08:53:48.1571465Z dotnet-install: Primary named payload URL: https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100/dotnet-sdk-3.0.100-linux-x64.tar.gz
2019-10-15T08:53:48.1572495Z dotnet-install: Legacy named payload URL: https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100/dotnet-dev-ubuntu.16.04-x64.3.0.100.tar.gz
2019-10-15T08:53:48.1573301Z dotnet-install: Repeatable invocation: ./install-dotnet.sh --version "3.0.100" --install-dir "/home/runner/.dotnet" --architecture "x64"
2019-10-15T08:53:49.5859766Z Extracting Package /home/runner/work/_temp/d9687f84-ac8b-48bd-970e-efd674827f7c
2019-10-15T08:53:49.5880330Z [command]/bin/tar xzC /home/runner/work/_temp/bbade897-bf88-42dc-9dd7-c97e97011c66 -f /home/runner/work/_temp/d9687f84-ac8b-48bd-970e-efd674827f7c
2019-10-15T08:53:52.3850249Z Caching tool
2019-10-15T08:53:53.6769662Z Successfully installed 3.0.100
2019-10-15T08:53:53.6784267Z ##[set-env name=DOTNET_ROOT;]/opt/hostedtoolcache/dncs
2019-10-15T08:53:53.6792889Z ##[add-path]/opt/hostedtoolcache/dncs/3.0.100/x64
2019-10-15T08:53:53.6815498Z Added matchers: 'csc'. Problem matchers scan action output for known warning or error strings and report these inline.
2019-10-15T08:53:53.6816060Z ##[add-matcher]/home/runner/work/_actions/actions/setup-dotnet/v1/.github/csc.json
2019-10-15T08:53:53.7292602Z ##[group]Run aarnott/nbgv@master
2019-10-15T08:53:53.7292823Z env:
2019-10-15T08:53:53.7292983Z CAKE_VERSION: 0.32.1
2019-10-15T08:53:53.7293249Z CAKE_SCRIPT: ./***.cake
2019-10-15T08:53:53.7294140Z DOTNET_ROOT: /opt/hostedtoolcache/dncs
2019-10-15T08:53:53.7294322Z ##[endgroup]
2019-10-15T08:53:53.7784628Z [command]dotnet tool install -g nbgv
2019-10-15T08:53:53.8805981Z
2019-10-15T08:53:53.8831636Z Welcome to .NET Core 3.0!
2019-10-15T08:53:53.8832919Z ---------------------
2019-10-15T08:53:53.8833194Z SDK Version: 3.0.100
2019-10-15T08:53:53.8833328Z
2019-10-15T08:53:53.8833552Z Telemetry
2019-10-15T08:53:53.8833968Z ---------
2019-10-15T08:53:53.8835228Z The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
2019-10-15T08:53:53.8836107Z
2019-10-15T08:53:53.8836734Z Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
2019-10-15T08:53:53.8836894Z
2019-10-15T08:53:53.8837188Z ----------------
2019-10-15T08:53:53.8837591Z Explore documentation: https://aka.ms/dotnet-docs
2019-10-15T08:53:53.8838211Z Report issues and find source on GitHub: https://github.com/dotnet/core
2019-10-15T08:53:53.8838650Z Find out what's new: https://aka.ms/dotnet-whats-new
2019-10-15T08:53:53.8839142Z Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
2019-10-15T08:53:53.8839708Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
2019-10-15T08:53:53.8840197Z Write your first app: https://aka.ms/first-net-core-app
2019-10-15T08:53:53.8840684Z --------------------------------------------------------------------------------------
2019-10-15T08:53:58.8634097Z Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.
2019-10-15T08:53:58.8658587Z You can invoke the tool using the following command: nbgv
2019-10-15T08:53:58.8659872Z Tool 'nbgv' (version '3.0.26') was successfully installed.
2019-10-15T08:53:58.9706859Z ##[add-path]/home/runner/.dotnet/tools
2019-10-15T08:53:58.9713389Z [command]nbgv get-version -f json
2019-10-15T08:53:58.9747869Z A fatal error occurred. The required library libhostfxr.so could not be found.
2019-10-15T08:53:58.9749160Z If this is a self-contained application, that library should exist in [/home/runner/.dotnet/tools/.store/nbgv/3.0.26/nbgv/3.0.26/tools/netcoreapp2.1/any/].
2019-10-15T08:53:58.9750616Z If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
2019-10-15T08:53:58.9812595Z ##[error]The process 'nbgv' failed with exit code 131
2019-10-15T08:53:58.9850464Z ##[error]Node run failed with exit code 1
I have follow the documentation here and I get error as below. What could be the issue?
CI-CD.yml
name: CI/CD
on:
pull_request:
branches:
- main # CI (pr validation)
push:
branches:
- main # CI (ci package)
tags:
- v\\d+\\.\\d+ # CD (release package)
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.x'
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: dotnet/nbgv@master
id: nbgv
- run: echo 'SemVer2=${{ steps.nbgv.outputs.SemVer2 }}'
- run: |
pwd
ls -alg
- run: dotnet build Shared.Database.Interface -c Release
version.json
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0",
"assemblyVersion": {
"precision": "build"
},
"publicReleaseRefSpec": [
"^refs/heads/master$"
]
}
github action Error
Run dotnet/nbgv@master
/usr/share/dotnet/dotnet tool install -g nbgv
Tool 'nbgv' is already installed.
/home/runner/.dotnet/tools/nbgv get-version -f json -p .
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidOperationException: Unable to get version from commit: e7c0b0c9[8](https://github.com/smart/Shared.Database.Interface/actions/runs/4796869255/jobs/8533139443#step:4:8)0bae41ce[9](https://github.com/smart/Shared.Database.Interface/actions/runs/4796869255/jobs/8533139443#step:4:10)1cdc14f247f361a23a21c3
---> Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: ". Path 'cloudBuild', line 9, position 1.
at Newtonsoft.Json.JsonTextReader.ParsePostValue(Boolean ignoreComments)
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Nerdbank.GitVersioning.VersionFile.TryReadVersionJsonContent(String jsonContent, String repoRelativeBaseDirectory)
at Nerdbank.GitVersioning.Managed.ManagedVersionFile.GetVersion(GitCommit commit, String repoRelativeProjectDirectory, Dictionary`2 blobVersionCache, String& actualDirectory)
at Nerdbank.GitVersioning.Managed.GitExtensions.GitWalkTracker.GetVersion(GitCommit commit)
--- End of inner exception stack trace ---
at Nerdbank.GitVersioning.Managed.GitExtensions.GitWalkTracker.GetVersion(GitCommit commit)
at Nerdbank.GitVersioning.Managed.GitExtensions.CommitMatchesVersion(GitCommit commit, SemanticVersion expectedVersion, Position comparisonPrecision, GitWalkTracker tracker)
at Nerdbank.GitVersioning.Managed.GitExtensions.<>c__DisplayClass1_0.<GetVersionHeight>b__0(GitCommit c)
at Nerdbank.GitVersioning.Managed.GitExtensions.<GetCommitHeight>g__TryCalculateHeight|4_0(GitCommit commit, <>c__DisplayClass4_0& )
at Nerdbank.GitVersioning.Managed.GitExtensions.GetCommitHeight(GitRepository repository, GitCommit startingCommit, GitWalkTracker tracker, Func`2 continueStepping)
at Nerdbank.GitVersioning.Managed.GitExtensions.GetHeight(ManagedGitContext context, Func`2 continueStepping)
at Nerdbank.GitVersioning.Managed.GitExtensions.GetVersionHeight(ManagedGitContext context, Version baseVersion)
at Nerdbank.GitVersioning.Managed.ManagedGitContext.CalculateVersionHeight(VersionOptions committedVersion, VersionOptions workingVersion)
at Nerdbank.GitVersioning.VersionOracle..ctor(GitContext context, ICloudBuild cloudBuild, Nullable`1 overrideVersionHeightOffset)
at Nerdbank.GitVersioning.Tool.Program.OnGetVersionCommand(String project, IReadOnlyList`1 metadata, String format, String variable, String commitish) in D:\a\1\s\src\nbgv\Program.cs:line 402
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__21_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__22_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__20_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__[10](https://github.com/smart/Shared.Database.Interface/actions/runs/4796869255/jobs/8533139443#step:4:11)_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass[14](https://github.com/smart/Shared.Database.Interface/actions/runs/4796869255/jobs/8533139443#step:4:15)_0.<<UseExceptionHandler>b__0>d.MoveNext()
Error: Unexpected end of JSON input
e.g. to ensure a published package has a corresponding git tag
(although you could also use the nbgv tool to match a version to a commit ofcourse)
Actions using dotnet/nbgv@master
show warnings related to this announcement
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.