Skip to content
Closed
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
5 changes: 1 addition & 4 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ on:
default: "ci-dotnet.yml"
description: "Name of the workflow to check for successful builds"
secrets:
NUGET_TOKEN:
required: false
description: "Legacy API key. Ignored when NUGET_USER is set (Trusted Publishing)."
NUGET_USER:
required: false
required: true
description: "nuget.org profile name for Trusted Publishing (OIDC)"
WORKFLOW_PACKAGES:
required: true
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/step-dotnet-publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ on:
default: "ci-dotnet.yml"
description: "Name of the workflow to check for successful builds"
secrets:
NUGET_TOKEN:
required: false
description: "Legacy API key. Ignored when NUGET_USER is set (Trusted Publishing)."
NUGET_USER:
required: false
required: true
description: "nuget.org profile name for Trusted Publishing (OIDC)"
WORKFLOW_PACKAGES:
required: true
Expand Down Expand Up @@ -56,13 +53,12 @@ jobs:

- name: NuGet login (Trusted Publishing)
id: login
if: ${{ env.NUGET_USER != '' }}
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
with:
user: ${{ env.NUGET_USER }}

- name: Publish NuGet Package
env:
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY || secrets.NUGET_TOKEN }}
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
run: |
dotnet nuget push packages/**/*.nupkg -k "$NUGET_API_KEY" -s https://api.nuget.org/v3/index.json --skip-duplicate
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ jobs:
runId: "1234567890" # Get this from the workflow run you want to publish
environment: "nuget-production"
secrets:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
NUGET_USER: ${{ secrets.NUGET_USER }}
WORKFLOW_PACKAGES: ${{ secrets.GITHUB_TOKEN }}
```

Expand All @@ -255,7 +255,7 @@ jobs:

| Secret | Description | Required |
| ------------------- | ----------------------------------------- | -------- |
| `NUGET_TOKEN` | NuGet API key for publishing | ✅ |
| `NUGET_USER` | nuget.org profile name (Trusted Publishing) | ✅ |
| `WORKFLOW_PACKAGES` | GitHub token for workflow/artifact access | ✅ |

**Prerequisites:**
Expand Down Expand Up @@ -568,7 +568,7 @@ jobs:
runId: "123456789"
workflowName: "build-dotnet-single.yml"
secrets:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
NUGET_USER: ${{ secrets.NUGET_USER }}
WORKFLOW_PACKAGES: ${{ secrets.GITHUB_TOKEN }}
```

Expand All @@ -587,7 +587,7 @@ jobs:

| Secret | Description | Required |
| ------------------- | -------------------------- | -------- |
| `NUGET_TOKEN` | NuGet API key | ✅ |
| `NUGET_USER` | nuget.org profile name (Trusted Publishing) | ✅ |
| `WORKFLOW_PACKAGES` | GitHub token for artifacts | ✅ |

**Note:** Consider using the higher-level `publish-nuget.yml` workflow instead for a more complete publishing solution.
Expand Down Expand Up @@ -731,7 +731,7 @@ jobs:
runId: "1234567890" # Replace with actual workflow run ID
environment: "nuget-production"
secrets:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
NUGET_USER: ${{ secrets.NUGET_USER }}
WORKFLOW_PACKAGES: ${{ secrets.GITHUB_TOKEN }}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/MANUAL_APPROVAL_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In the environment configuration:
If you need environment-specific secrets:

1. In the environment configuration, scroll to **Environment secrets**
2. Add any environment-specific secrets (e.g., different NUGET_TOKEN for staging vs production)
2. Add any environment-specific secrets (e.g., different NUGET_USER for staging vs production)

## Usage Example

Expand All @@ -49,7 +49,7 @@ jobs:
with:
environment: "nuget-production" # Your configured environment name
secrets:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
NUGET_USER: ${{ secrets.NUGET_USER }}
```

## Approval Process
Expand Down
Loading