Skip to content

Commit f122f00

Browse files
[Infra] Use dotnet nuget to push packages (#6473)
Co-authored-by: Rajkumar Rangaraj <[email protected]>
1 parent 597b5f7 commit f122f00

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.github/workflows/post-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
5050
ref: ${{ github.event.repository.default_branch }}
5151

52+
- name: Setup .NET
53+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
54+
5255
- name: Push packages and publish release
5356
shell: pwsh
5457
env:

.github/workflows/publish-packages-1.0.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,15 @@ jobs:
8787
if-no-files-found: error
8888

8989
- name: Publish MyGet
90+
working-directory: ./artifacts/package/release
9091
env:
9192
MYGET_TOKEN_EXISTS: ${{ secrets.MYGET_TOKEN != '' }}
93+
API_KEY: ${{ secrets.MYGET_TOKEN }}
94+
SOURCE: https://www.myget.org/F/opentelemetry/api/v2/package
9295
if: env.MYGET_TOKEN_EXISTS == 'true' # Skip MyGet publish if run on a fork without the secret
96+
shell: pwsh
9397
run: |
94-
nuget setApiKey ${{ secrets.MYGET_TOKEN }} -Source https://www.myget.org/F/opentelemetry/api/v2/package
95-
nuget push ./artifacts/package/release/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
98+
dotnet nuget push *.nupkg --api-key ${env:API_KEY} --skip-duplicate --source ${env:SOURCE}
9699
97100
post-build:
98101
runs-on: ubuntu-22.04
@@ -130,7 +133,7 @@ jobs:
130133
CreateDraftRelease `
131134
-gitRepository '${{ github.repository }}' `
132135
-tag '${{ github.ref_name }}' `
133-
-releaseFiles '${{ github.workspace }}/artifacts/${{ github.ref_name }}-packages.zip#Packages'
136+
-releaseFiles '${{ github.workspace }}/artifacts/${{ github.ref_name }}-packages.zip'
134137
135138
- name: Post notice when packages are ready
136139
shell: pwsh

build/scripts/post-release.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function PushPackagesPublishReleaseUnlockAndPostNoticeOnPrepareReleasePullReques
236236
gh pr comment $pullRequestNumber `
237237
--body "I am uploading the packages for ``$tag`` to NuGet and then I will publish the release."
238238

239-
nuget push "$artifactDownloadPath/**/*.nupkg" -Source https://api.nuget.org/v3/index.json -ApiKey "$env:NUGET_TOKEN" -SymbolApiKey "$env:NUGET_TOKEN"
239+
dotnet nuget push "$artifactDownloadPath/**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key "$env:NUGET_TOKEN" --symbol-api-key "$env:NUGET_TOKEN"
240240

241241
if ($LASTEXITCODE -gt 0)
242242
{

0 commit comments

Comments
 (0)