mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
fix(release): 修复 GitHub Release 中的包文件名获取逻辑
- 更新工作流步骤名称以反映版本和路径获取 - 从 .nupkg 文件中正确解析 NuGet 包的基本文件名 - 在 GitHub 输出中添加 package_basename 变量 - 使用 package_basename 作为上传资产的准确文件名 - 确保 release 资产使用正确的文件名而非完整路径
This commit is contained in:
parent
fda0574789
commit
8573fceff7
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@ -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> 标签(稳妥)
|
||||
VERSION=$(unzip -p "$PACKAGE_FILE" *.nuspec 2>/dev/null | sed -n 's:.*<version>\(.*\)</version>.*:\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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user