Skip to content

Commit

Permalink
Added step to set package version for release
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleCrowley authored Jan 7, 2021
1 parent 07584ce commit c6d9a5f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,22 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Create NuGet package
# Legacy (.symbols.nupkg) symbols are no longer supported by the NuGet Gallery symbol server.
# By default, dotnet pack will create a .symbols.nupkg if --include-symbols is specified.
# However, if we add the -p:SymbolPackageFormat=snupkg flag, dotnet pack will create a .snupkg instead.
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
# https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg
- name: Set Package Version
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-source --include-symbols -p:SymbolPackageFormat=snupkg -p:PackageVersion=$VERSION -o nupkg $PROJECT_NAME/$PROJECT_NAME.*proj
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Create NuGet package
# Legacy (.symbols.nupkg) symbols are no longer supported by the NuGet Gallery symbol server.
# By default, dotnet pack will create a .symbols.nupkg if --include-symbols is specified.
# However, if we add the -p:SymbolPackageFormat=snupkg flag, dotnet pack will create a .snupkg instead.
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
# https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg
run: dotnet pack -v normal -c Release --include-source --include-symbols -p:SymbolPackageFormat=snupkg -p:PackageVersion=$PACKAGE_VERSION -o nupkg $PROJECT_NAME/$PROJECT_NAME.*proj
- name: Push to NuGet feed
# The symbols package (snupkg) will be pushed alongside the package itself (nupkg). No need to use a regex.
# https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#publishing-a-symbol-package
run: dotnet nuget push ./nupkg/$PROJECT_NAME.$VERSION.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
run: dotnet nuget push ./nupkg/$PROJECT_NAME.$PACKAGE_VERSION.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY

0 comments on commit c6d9a5f

Please sign in to comment.