From 8573fceff70917f53c843884cfebf2f4d2e24736 Mon Sep 17 00:00:00 2001 From: GwWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Tue, 9 Dec 2025 17:14:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(release):=20=E4=BF=AE=E5=A4=8D=20GitHub=20R?= =?UTF-8?q?elease=20=E4=B8=AD=E7=9A=84=E5=8C=85=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新工作流步骤名称以反映版本和路径获取 - 从 .nupkg 文件中正确解析 NuGet 包的基本文件名 - 在 GitHub 输出中添加 package_basename 变量 - 使用 package_basename 作为上传资产的准确文件名 - 确保 release 资产使用正确的文件名而非完整路径 --- .github/workflows/release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2486bd8..e4425f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: - name: Pack run: dotnet pack --no-build -c Release -o ./packages - - name: Get Version from .nupkg + - name: Get Version and Package Path id: get_version run: | set -e @@ -41,12 +41,15 @@ jobs: echo "No .nupkg file found in ./packages" exit 1 fi + # 从 .nupkg(zip)里读取 .nuspec 并提取 标签(稳妥) VERSION=$(unzip -p "$PACKAGE_FILE" *.nuspec 2>/dev/null | sed -n 's:.*\(.*\).*:\1:p' | head -n1) if [ -z "$VERSION" ]; then echo "Failed to parse version from $PACKAGE_FILE" exit 1 fi + BASENAME=$(basename "$PACKAGE_FILE") echo "package_file=$PACKAGE_FILE" >> $GITHUB_OUTPUT + echo "package_basename=$BASENAME" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Create GitHub Release @@ -68,5 +71,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ steps.get_version.outputs.package_file }} - asset_name: ${{ steps.get_version.outputs.package_file && (steps.get_version.outputs.package_file | basename) || 'package.nupkg' }} + asset_name: ${{ steps.get_version.outputs.package_basename }} asset_content_type: application/octet-stream