Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
48 changes: 48 additions & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish NuGet Package

on:
workflow_dispatch:
inputs:
version:
description: 'Package version to publish (e.g. 3.0.1). Leave empty to use the version currently set in API.csproj'
required: false
type: string

jobs:
publish:

runs-on: windows-latest

permissions:
id-token: write # enable GitHub OIDC token issuance, required for NuGet Trusted Publishing

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: Restore dependencies
run: dotnet restore Api\API.csproj

- name: Build
run: dotnet build Api\API.csproj --configuration Release --no-restore

- name: Pack (with specified version)
if: ${{ github.event.inputs.version != '' }}
run: dotnet pack Api\API.csproj --configuration Release --no-build --output ./nupkg /p:PackageVersion=${{ github.event.inputs.version }} /p:Version=${{ github.event.inputs.version }}

- name: Pack (with version from csproj)
if: ${{ github.event.inputs.version == '' }}
run: dotnet pack Api\API.csproj --configuration Release --no-build --output ./nupkg

- name: NuGet login (OIDC → temp API key)
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}

- name: Publish to NuGet
run: dotnet nuget push ./nupkg/KoenZomers.OneDrive.Api.*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
Loading