Skip to content

Publish latest release to nuget

Actions
Checkout to version of last release, build, test and publish on nuget.org package with same version as release
v1
Latest
Star (0)

action-publish-nuget

Action to build latest release and publicate it on nuget as package with same version

Example

  1. Create API key on nuget.org and save it on GitHub in 'Secrets and variables'

  2. Add to your .csproj file:

    <PropertyGroup>
        <TargetFramework>net7.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
        <Title>MyPackage</Title>
        <PackageId>MyPackage</PackageId>
        <Description>About</Description>
        <RepositoryUrl>https://github.com/user/repo</RepositoryUrl>
        <RepositoryType>git</RepositoryType>
        <Authors>NugetUsername</Authors>
    </PropertyGroup>
  3. Create GitHub action:

    name: Release to NuGet
    
    on:
      release:
        types: [published]
    
    jobs:
      build:
        runs-on: ubuntu-latest
        timeout-minutes: 5
        steps:
          - name: NugetPublish
            uses: maxchistt/action-publish-nuget@v1
            with:
              NUGET_APIKEY: ${{secrets.NUGET_APIKEY}}
              working-directory: ./MyPackage
  4. Publish GitHub release, named like 'v1.0.0' or '1.0.0'

Publish latest release to nuget is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Checkout to version of last release, build, test and publish on nuget.org package with same version as release
v1
Latest

Publish latest release to nuget is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.