Skip to content

Commit 0c26936

Browse files
committed
Use 'gpr' to push to GitHub Package Registry.
This is to try to avoid the following warnings from the workflow: WARNING: No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/mysql-net'. To save an API Key for a source use the 'setApiKey' command. Pushing MySqlConnector.1.3.12-beta.0.5.nupkg to 'https://nuget.pkg.github.com/mysql-net'... PUT https://nuget.pkg.github.com/mysql-net/ WARNING: Please use the --api-key option when publishing to GitHub Packages This solution comes from https://github.community/t/github-package-registry-not-compatible-with-dotnet-nuget-client/14392/19.
1 parent 26ff8e5 commit 0c26936

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

.github/workflows/publish-package.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ jobs:
3636
- name: Pack
3737
run: dotnet pack --configuration Release --no-build
3838

39-
- name: Install NuGet
40-
run: choco install nuget.commandline
41-
42-
- name: Add NuGet source
43-
run: nuget sources Add -Name "GPR" -Source "https://nuget.pkg.github.com/mysql-net/index.json" -UserName bgrainger -Password ${{ secrets.GITHUB_TOKEN }}
39+
- name: Install gpr tool
40+
run: dotnet tool install -g gpr --no-cache -v q
4441

4542
- name: Publish packages
4643
run: |
4744
$files = Get-ChildItem -Path src -Filter *.nupkg -Recurse
4845
foreach ($file in $files) {
49-
nuget push $file -Source GPR
46+
gpr push --api-key $GITHUB_ACCESS_TOKEN $file
5047
}

0 commit comments

Comments
 (0)