I am publishing a Nuget package from a GitHub Actions Workflow (.yml file listed below) to GitHub Packages.
C# Project file PropertyGroup:
As shown below the project's.csproj
file does not contain a value for VersionSuffix
:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
<VersionPrefix>1.4.0</VersionPrefix>
<Version>1.4.0</Version>
<PackageVersion>1.4.0</PackageVersion>
<VersionSuffix></VersionSuffix>
<InformationalVersion>This is a package.</InformationalVersion>
</PropertyGroup>
GitHub Actions Workflow .yml File:
name: Build, Pack, Publish
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.109
- name: dotnet build
run: dotnet build --configuration Release
- name: Install NuGet client
uses: warrenbuckley/Setup-Nuget@v1
- name: Add private GitHub registry to NuGet
run: nuget sources add -name "GPR" -Source https://nuget.pkg.github.com/Operator9/index.json -Username Operator9 -Password ${{ secrets.GITHUB_TOKEN }}
- name: Pack
run: dotnet pack -c Release -o out
- name: Push generated package to GitHub registry
run: nuget push .\out\*.nupkg -Source "GPR" -SkipDuplicate
Problem:
Everything in the workflow executes fine except the package is always considered prerelease
.
Testing Method 1:
When I visit this URL my package is only listed if I change prerelease=false
to prerelease=true
https://nuget.pkg.github.com/Operator9/query?q=MyPackageName&prerelease=false
Testing Method 2:
The same behavior exists from within Visual Studio Nuget Package Manager. The package is only visible if I check "Include prerelease".
There's some minimal properties that you must specify inside the <PropertyGroup>
tag on your csproj.
<PackageId>AppLogger</PackageId>
<Version>1.0.0</Version>
<Authors>your_name</Authors>
<Company>your_company</Company>
Looks like you need PackageId, Authors and Company.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With