-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83ca0c7
commit aac0809
Showing
1 changed file
with
12 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,35 +37,19 @@ jobs: | |
key: vertical-template-nuget | ||
path: ~/.nuget/packages | ||
|
||
# https://github.com/dotnet/Nerdbank.GitVersioning/blob/81162b84f1e81864d3c79ddfc4ce9794ae065574/doc/nbgv-cli.md | ||
- name: Install nbgv dotnet tools | ||
run: dotnet tool install --global nbgv | ||
|
||
- name: nbgv Version | ||
id: nbgv-version | ||
run: | | ||
version_info=$(nbgv get-version -f json) | ||
echo "$version_info" | ||
echo "Version=$(echo $version_info | grep -Po '(?<=\"Version\":\s\").*?(?=\")')" >> $GITHUB_OUTPUT | ||
echo "AssemblyVersion=$(echo $version_info | grep -Po '(?<=\"AssemblyVersion\":\s\").*?(?=\")')" >> $GITHUB_OUTPUT | ||
echo "NuGetPackageVersion=$(echo $version_info | grep -Po '(?<=\"NuGetPackageVersion\":\s\").*?(?=\")')" >> $GITHUB_OUTPUT | ||
echo "SemVer2=$(echo $version_info | grep -Po '(?<=\"SemVer2\":\s\").*?(?=\")')" >> $GITHUB_OUTPUT | ||
- name: Use Version Outputs | ||
run: | | ||
echo "BuildMetadataFragment: ${{ steps.nbgv-version.outputs.Version }}" | ||
echo "NuGetPackageVersion: ${{ steps.nbgv-version.outputs.AssemblyVersion }}" | ||
echo "ChocolateyPackageVersion: ${{ steps.nbgv-version.outputs.NuGetPackageVersion }}" | ||
echo "NpmPackageVersion: ${{ steps.nbgv-version.outputs.SemVer2 }}" | ||
# https://github.com/joseftw/jos.enumeration/blob/main/.github/workflows/verify.yml | ||
# https://github.com/dotnet/Nerdbank.GitVersioning | ||
- uses: dotnet/[email protected] | ||
id: nbgv | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore Vertical.Slice.Template.sln | ||
|
||
- name: Build Version ${{ steps.nbgv-version.outputs.NuGetPackageVersion }} | ||
- name: Build Version ${{ steps.nbgv.outputs.SemVer2 }} | ||
run: dotnet build Vertical.Slice.Template.sln -c Release --no-restore | ||
|
||
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack | ||
- name: Pack NuGet Package Version ${{ steps.nbgv-version.outputs.NuGetPackageVersion }} | ||
- name: Pack NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} | ||
run: dotnet pack vertical-slice-template.csproj -c Release -o ${{ env.NuGetDirectory }} | ||
|
||
# Publish the NuGet package as an artifact, so they can be used in the following jobs | ||
|
@@ -101,25 +85,20 @@ jobs: | |
with: | ||
dotnet-version: "8.0.x" | ||
|
||
# https://github.com/dotnet/Nerdbank.GitVersioning/blob/81162b84f1e81864d3c79ddfc4ce9794ae065574/doc/nbgv-cli.md | ||
- name: Install nbgv dotnet tools | ||
run: dotnet tool install -g nbgv | ||
|
||
- name: nbgv Version | ||
id: nbgv-version | ||
run: | | ||
$version = nbgv get-version -f json | ConvertFrom-Json | ||
echo "version=$($version.NuGetPackageVersion)" >> "$GITHUB_OUTPUT" | ||
# https://github.com/joseftw/jos.enumeration/blob/main/.github/workflows/verify.yml | ||
# https://github.com/dotnet/Nerdbank.GitVersioning | ||
- uses: dotnet/[email protected] | ||
id: nbgv | ||
|
||
# for publish package to github for each commit | ||
- name: Publish NuGet Package Version ${{ steps.nbgv-version.outputs.version }} to GitHub | ||
- name: Publish NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} to GitHub | ||
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --skip-duplicate | ||
if: github.event_name == 'push' && startswith(github.ref, 'refs/heads') | ||
|
||
# Publish all NuGet packages to NuGet.org | ||
# Use --skip-duplicate to prevent errors if a package with the same version already exists. | ||
# If you retry a failed workflow, already published packages will be skipped without error. | ||
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push | ||
- name: Publish NuGet Package Version ${{ steps.nbgv-version.outputs.version }} to Nuget | ||
- name: Publish NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} to Nuget | ||
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --skip-duplicate --source ${{ env.FEED_SOURCE }} --api-key ${{ env.FEED_API_KEY }} | ||
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags') |