Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GitHub Packages Private Nuget
name: Build .Net Core projects
on:
push:
branches:
- master
- dev
pull_request:
branches:
- dev
env:
GitHubPackagesUser: <User who created the PersonalAccessToken> #Since this has to be associated with a GitHub user this should be a bot or an owner of the org
GitHubPackagesPersonalAccessToken: ${{secrets.GitHubPackagesPersonalAccessToken}}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: Install dependencies
run: dotnet restore --no-cache
- name: Build
run: dotnet build --configuration Release --no-restore
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="github" value="https://nuget.pkg.github.com/<GitHubOrgName>/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="%GitHubPackagesUser%" />
<add key="ClearTextPassword" value="%GitHubPackagesPersonalAccessToken%" />
</github>
</packageSourceCredentials>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment