Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.46 KB

use-github-package-registry.md

File metadata and controls

53 lines (37 loc) · 1.46 KB

Use Github Nuget Registry

Resource

Publish the package to Github Registry

Create a PAT (Personal Access Token)

  • Go to Settings > Developer settings
  • Create a PAT

Create a nuget config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="github" value="https://nuget.pkg.github.com/{{your organisation}}/index.json" />
  </packageSources>
</configuration>

Publish the package

dotnet nuget push "Fonoa.Optimus.MetricsLib.0.1.0.nupkg" -k {{ your pat }} --source "github"

Consume the package

Create a nuget.config in the root directory of your consuming project. As I use PAT, the username can be any non-null string.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="github" value="https://nuget.pkg.github.com/{{your org}}/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <github>
      <add key="Username" value="any-string" />
      <add key="ClearTextPassword" value="{{ your pat with read access }}" />
    </github>
  </packageSourceCredentials>
</configuration>