Skip to content

Commit 2be1c0c

Browse files
authored
Update windows-mdirve.yml
1 parent 1f85b34 commit 2be1c0c

File tree

1 file changed

+21
-50
lines changed

1 file changed

+21
-50
lines changed
Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,27 @@
1-
name: Build and Release .NET Application
1+
name: Release Windows CI
22

33
on:
4-
push:
5-
branches:
6-
- main # 修改为你的主分支名称
4+
release:
5+
types: [published]
76

87
jobs:
9-
build_and_release:
10-
name: 构建并发布 .NET 应用程序
11-
runs-on: windows-latest
8+
build:
9+
strategy:
10+
matrix:
11+
configuration: [Release]
1212

13-
steps:
14-
- name: 检出仓库代码
15-
uses: actions/checkout@v3 # 使用最新稳定版本
16-
17-
- name: 设置 .NET 环境
18-
uses: actions/setup-dotnet@v3 # 使用最新稳定版本
19-
with:
20-
dotnet-version: '8.0.x' # 确保使用的 .NET 版本与你的项目版本匹配
21-
22-
- name: 构建并发布 .NET 应用程序
23-
run: |
24-
dotnet publish src/MDriveSync.Client.API/Properties/PublishProfiles/Client.Publish.SelfContained.win.x64.pubxml -c Release -o publish
25-
26-
- name: 删除 PDB 和 XML 文件
27-
run: |
28-
# 删除目录中的 .pdb 和 .xml 文件(如果存在)
29-
Remove-Item publish/*.pdb -Force -ErrorAction SilentlyContinue
30-
Remove-Item publish/*.xml -Force -ErrorAction SilentlyContinue
13+
runs-on: windows-latest
3114

32-
- name: 压缩构建产物
33-
run: |
34-
# 将发布目录中的文件压缩为 zip 文件
35-
Compress-Archive -Path publish/* -DestinationPath "MDrive-win-x64-v${{ github.sha }}.zip"
36-
37-
- name: 创建 GitHub Release
38-
id: create_release
39-
uses: actions/create-release@v1
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
with:
43-
tag_name: "v${{ github.sha }}"
44-
release_name: "Release v${{ github.sha }}"
45-
draft: false
46-
prerelease: false
47-
48-
- name: 上传 ZIP 文件到 release
49-
uses: actions/upload-release-asset@v1 # 使用最新稳定版本
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
with:
53-
upload_url: ${{ steps.create_release.outputs.upload_url }}
54-
asset_path: "MDrive-win-x64-v${{ github.sha }}.zip"
55-
asset_name: "MDrive-win-x64-v${{ github.sha }}.zip"
56-
asset_content_type: application/zip
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Build
20+
run: cd scripts && .\build.ps1
21+
22+
- name: Upload build artifacts
23+
uses: actions/upload-artifact@v3
24+
with:
25+
name: MDrive
26+
path:
27+
.\scripts\MDrive.zip

0 commit comments

Comments
 (0)