Skip to content

Added GitHub Packages as a NuGet source #5

Added GitHub Packages as a NuGet source

Added GitHub Packages as a NuGet source #5

Workflow file for this run

name: CI/CD Workflow
on:
push:
branches:
- main
pull_request:
jobs:
build-test-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history required by Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build application
run: dotnet build --configuration Release --no-restore
- name: Run tests
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack application as global tool
run: dotnet pack --configuration Release --output ./nupkgs
- name: Add GitHub Packages as a NuGet source
run: |
dotnet nuget add source \
--name github \
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \
--username ${{ github.repository_owner }} \
--password ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
dotnet nuget push ./nupkgs/*.nupkg \
--source "github" \
--api-key $GITHUB_TOKEN