Skip to content

Commit 712c897

Browse files
ci: fix pipeline failing on duplicate NuGet package push (#269)
Re-runs of the CI workflow on the same commit/tag produce the same effective NuGet version because NuGet ignores SemVer build metadata (`+N`) when comparing versions, causing a 409 Conflict on the second push. ## Changes - **`--skip-duplicate`** added to `dotnet nuget push` in `ci.yml` — silently skips already-published versions instead of failing - **`MINVERBUILDMETADATA` syntax fixed** — changed `build.$GITHUB_RUN_ATTEMPT` (unexpanded shell variable reference) to `build.${{ github.run_attempt }}` (valid GitHub Actions expression) ```yaml # Before MINVERBUILDMETADATA: build.$GITHUB_RUN_ATTEMPT run: dotnet nuget push "./artifacts/*.nupkg" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} # After MINVERBUILDMETADATA: build.${{ github.run_attempt }} run: dotnet nuget push "./artifacts/*.nupkg" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate ``` <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/alistar-dev/FluentEmail.Graph/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DavidDeSloovere <352626+DavidDeSloovere@users.noreply.github.com>
1 parent e21b3a3 commit 712c897

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
env:
1616
DOTNET_NOLOGO: true
1717
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
18-
MINVERBUILDMETADATA: build.$GITHUB_RUN_ATTEMPT
18+
MINVERBUILDMETADATA: build.${{ github.run_attempt }}
1919

2020
steps:
2121
- name: ☁ Checkout
@@ -50,5 +50,5 @@ jobs:
5050
"https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
5151
5252
- name: 🚀 Publish to GitHub packages
53-
run: dotnet nuget push "./artifacts/*.nupkg" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}
53+
run: dotnet nuget push "./artifacts/*.nupkg" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
5454

0 commit comments

Comments
 (0)