返回提交历史
Modified
.github/workflows/publish-packages.yml
+20
-2
XFEstudio/XFEExtension.NetCore.WinUIHelper
改用 PowerShell 脚本发布 NuGet 包并增强错误处理
将发布到 GitHub Packages 和 NuGet.org 的步骤由单行 dotnet 命令改为 PowerShell 脚本。脚本会检查 .nupkg 文件是否存在,无包时报错,有包时逐个发布,提升多包处理和错误提示能力。
a439b4d
代码差异
1 个文件
+20
-2
@@ -76,11 +76,29 @@ jobs:
76
76
if-no-files-found: error
77
77
78
78
- name: Publish to GitHub Packages
79
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate
79
shell: pwsh
80
run: |
81
$packages = Get-ChildItem -Path "${{ env.PACKAGE_OUTPUT_DIR }}" -Filter *.nupkg -File
82
if (-not $packages) {
83
throw "No .nupkg files found in ${{ env.PACKAGE_OUTPUT_DIR }}"
84
}
85
86
foreach ($package in $packages) {
87
dotnet nuget push $package.FullName --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate
88
}
80
89
81
90
- name: Publish to NuGet.org
82
91
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_nuget_org }}
83
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key "${{ secrets.NUGET_API_KEY }}" --skip-duplicate
92
shell: pwsh
93
run: |
94
$packages = Get-ChildItem -Path "${{ env.PACKAGE_OUTPUT_DIR }}" -Filter *.nupkg -File
95
if (-not $packages) {
96
throw "No .nupkg files found in ${{ env.PACKAGE_OUTPUT_DIR }}"
97
}
98
99
foreach ($package in $packages) {
100
dotnet nuget push $package.FullName --source "https://api.nuget.org/v3/index.json" --api-key "${{ secrets.NUGET_API_KEY }}" --skip-duplicate
101
}
84
102
85
103
- name: Create GitHub Release
86
104
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}