Skip to content

Build & Publish NuGet to GitHub Registry #4

Build & Publish NuGet to GitHub Registry

Build & Publish NuGet to GitHub Registry #4

name: Build & Publish NuGet to GitHub Registry
on:
workflow_dispatch:
env:
NuGetDirectory: ${{ github.workspace }}/nuget
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Build and Pack NuGet package with versioning
run: dotnet pack sdk/dotnet/src/Datastar.fsproj --configuration Release --output ${{ env.NuGetDirectory }}
- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: ${{ env.NuGetDirectory }}/*.nupkg
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nugetPackage
path: nugetPackage
- name: Publish to NuGet.org
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate