Skip to content

Commit 2379184

Browse files
committed
测试发布
1 parent 417c490 commit 2379184

File tree

2 files changed

+54
-16
lines changed

2 files changed

+54
-16
lines changed

.github/workflows/nuget-publish.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
- name: Pack NuGet package
4848
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./packages
4949

50+
- name: List packages for debugging
51+
run: Get-ChildItem -Path "./packages" -Recurse
52+
5053
- name: Upload NuGet package as artifact
5154
uses: actions/upload-artifact@v4
5255
with:
@@ -70,12 +73,25 @@ jobs:
7073
with:
7174
dotnet-version: ${{ env.DOTNET_VERSION }}
7275

76+
- name: Verify packages exist
77+
run: |
78+
if (-not (Test-Path "./packages/*.nupkg")) {
79+
Write-Error "No .nupkg files found in ./packages directory"
80+
Get-ChildItem -Path "./packages" -Recurse
81+
exit 1
82+
}
83+
Write-Host "Found packages:"
84+
Get-ChildItem -Path "./packages" -Filter "*.nupkg"
85+
7386
- name: Publish NuGet package
7487
run: |
75-
dotnet nuget push ./packages/*.nupkg `
76-
--api-key ${{ secrets.NUGET_API_KEY }} `
77-
--source https://api.nuget.org/v3/index.json `
78-
--skip-duplicate
88+
$nupkgFiles = Get-ChildItem -Path "./packages" -Filter "*.nupkg"
89+
foreach ($file in $nupkgFiles) {
90+
dotnet nuget push $file.FullName `
91+
--api-key ${{ secrets.NUGET_API_KEY }} `
92+
--source https://api.nuget.org/v3/index.json `
93+
--skip-duplicate
94+
}
7995
env:
8096
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8197

@@ -96,11 +112,24 @@ jobs:
96112
with:
97113
dotnet-version: ${{ env.DOTNET_VERSION }}
98114

115+
- name: Verify packages exist
116+
run: |
117+
if (-not (Test-Path "./packages/*.nupkg")) {
118+
Write-Error "No .nupkg files found in ./packages directory"
119+
Get-ChildItem -Path "./packages" -Recurse
120+
exit 1
121+
}
122+
Write-Host "Found packages:"
123+
Get-ChildItem -Path "./packages" -Filter "*.nupkg"
124+
99125
- name: Publish to GitHub Packages
100126
run: |
101-
dotnet nuget push ./packages/*.nupkg `
102-
--api-key ${{ secrets.GITHUB_TOKEN }} `
103-
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
104-
--skip-duplicate
127+
$nupkgFiles = Get-ChildItem -Path "./packages" -Filter "*.nupkg"
128+
foreach ($file in $nupkgFiles) {
129+
dotnet nuget push $file.FullName `
130+
--api-key ${{ secrets.GITHUB_TOKEN }} `
131+
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
132+
--skip-duplicate
133+
}
105134
env:
106135
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
- name: Pack NuGet package
4646
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./packages
4747

48+
- name: List packages for debugging
49+
run: Get-ChildItem -Path "./packages" -Recurse
50+
4851
- name: Create GitHub Release
4952
uses: softprops/action-gh-release@v1
5053
with:
@@ -55,16 +58,22 @@ jobs:
5558

5659
- name: Publish to NuGet.org
5760
run: |
58-
dotnet nuget push ./packages/*.nupkg `
59-
--api-key ${{ secrets.NUGET_API_KEY }} `
60-
--source https://api.nuget.org/v3/index.json `
61-
--skip-duplicate
61+
$nupkgFiles = Get-ChildItem -Path "./packages" -Filter "*.nupkg"
62+
foreach ($file in $nupkgFiles) {
63+
dotnet nuget push $file.FullName `
64+
--api-key ${{ secrets.NUGET_API_KEY }} `
65+
--source https://api.nuget.org/v3/index.json `
66+
--skip-duplicate
67+
}
6268
6369
- name: Publish to GitHub Packages
6470
run: |
65-
dotnet nuget push ./packages/*.nupkg `
66-
--api-key ${{ secrets.GITHUB_TOKEN }} `
67-
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
68-
--skip-duplicate
71+
$nupkgFiles = Get-ChildItem -Path "./packages" -Filter "*.nupkg"
72+
foreach ($file in $nupkgFiles) {
73+
dotnet nuget push $file.FullName `
74+
--api-key ${{ secrets.GITHUB_TOKEN }} `
75+
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
76+
--skip-duplicate
77+
}
6978
env:
7079
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)