Skip to content

Commit

Permalink
Update dotnet-desktop.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
trueai-org authored Jun 20, 2024
1 parent 6ce431f commit d1617bd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ jobs:
with:
dotnet-version: '8.0.x' # 确保使用的 .NET 版本与你的项目版本匹配

- name: 列出目录内容 (调试步骤)
run: |
dir src/MDriveSync.Client.API/Properties/PublishProfiles
- name: 构建并发布 .NET 应用程序
run: |
dotnet publish src/MDriveSync.Client.API/Properties/PublishProfiles/Client.Publish.SelfContained.win.x64.pubxml -c Release -o publish
dotnet publish src/MDriveSync.Client.API --no-build -c Release /p:PublishProfile=Client.Publish.SelfContained.win.x64.pubxml
- name: 删除 PDB 和 XML 文件
run: |
# 删除目录中的 .pdb 和 .xml 文件(如果存在)
Remove-Item publish/*.pdb -Force -ErrorAction SilentlyContinue
Remove-Item publish/*.xml -Force -ErrorAction SilentlyContinue
Remove-Item src/MDriveSync.Client.API/bin/Release/net8.0/publish/*.pdb -Force -ErrorAction SilentlyContinue
Remove-Item src/MDriveSync.Client.API/bin/Release/net8.0/publish/*.xml -Force -ErrorAction SilentlyContinue
- name: 压缩构建产物
run: |
# 将发布目录中的文件压缩为 zip 文件
Compress-Archive -Path publish/* -DestinationPath "MDrive-win-x64-v${{ github.sha }}.zip"
Compress-Archive -Path src/MDriveSync.Client.API/bin/Release/net8.0/publish/* -DestinationPath "MDrive-win-x64-v${{ github.sha }}.zip"
- name: 创建 GitHub Release
id: create_release
Expand All @@ -46,7 +50,7 @@ jobs:
prerelease: false

- name: 上传 ZIP 文件到 release
uses: actions/upload-release-asset@v2 # 使用最新稳定版本
uses: actions/upload-release-asset@v1 # 使用最新稳定版本
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down

0 comments on commit d1617bd

Please sign in to comment.