@@ -14,17 +14,14 @@ jobs:
1414 - os : windows-latest
1515 runtime : win-x64
1616 artifact-name : DotNetCampus.Terminal-win-x64
17- executable-name : DotNetCampus.Terminal-win-x64.exe
1817 path-separator : ' \'
1918 - os : ubuntu-latest
2019 runtime : linux-x64
2120 artifact-name : DotNetCampus.Terminal-linux-x64
22- executable-name : DotNetCampus.Terminal-linux-x64
2321 path-separator : ' /'
2422 - os : macos-latest
2523 runtime : osx-x64
2624 artifact-name : DotNetCampus.Terminal-osx-x64
27- executable-name : DotNetCampus.Terminal-osx-x64
2825 path-separator : ' /'
2926
3027 steps :
4239 - name : Set tag to version
4340 run : dotnet TagToVersion -t ${{ github.ref }}
4441
42+ - name : Extract version from tag
43+ id : get_version
44+ run : |
45+ # Extract version from tag (remove 'v' prefix if present)
46+ VERSION="${{ github.ref_name }}"
47+ VERSION=${VERSION#v}
48+ echo "version=$VERSION" >> $GITHUB_OUTPUT
49+ echo "Extracted version: $VERSION"
50+ shell : bash
51+
4552 - name : Restore dependencies
4653 run : dotnet restore
4754
@@ -53,45 +60,40 @@ jobs:
5360 if : matrix.os != 'windows-latest'
5461 run : dotnet publish ./src/DotNetCampus.Terminal/ -p:PublishAot=true -r ${{ matrix.runtime }} --configuration Release --output ./publish/${{ matrix.runtime }}
5562
56- - name : Rename executable (Windows)
63+ - name : Clean debug files and create release package (Windows)
5764 if : matrix.os == 'windows-latest'
5865 run : |
59- if (Test-Path ".\publish\${{ matrix.runtime }}\DotNetCampus.Terminal.exe") {
60- Rename-Item ".\publish\${{ matrix.runtime }}\DotNetCampus.Terminal.exe" "${{ matrix.executable-name }}"
61- }
62- shell : pwsh
63-
64- - name : Rename executable (Unix)
65- if : matrix.os != 'windows-latest'
66- run : |
67- if [ -f "./publish/${{ matrix.runtime }}/DotNetCampus.Terminal" ]; then
68- mv "./publish/${{ matrix.runtime }}/DotNetCampus.Terminal" "./publish/${{ matrix.runtime }}/${{ matrix.executable-name }}"
69- fi
70-
71- - name : Create release package (Windows)
72- if : matrix.os == 'windows-latest'
73- run : |
74- # 创建临时文件夹,复制所有发布文件
66+ # 创建临时文件夹
7567 New-Item -ItemType Directory -Path ".\temp-release" -Force
76- Copy-Item -Path ".\publish\${{ matrix.runtime }}\*" -Destination ".\temp-release\" -Recurse
77- # 创建 zip 包,不包含外层文件夹
78- Compress-Archive -Path ".\temp-release\*" -DestinationPath ".\${{ matrix.artifact-name }}.zip"
68+ # 复制所有发布文件,排除调试文件
69+ Get-ChildItem -Path ".\publish\${{ matrix.runtime }}" -Recurse |
70+ Where-Object { $_.Extension -notin @('.pdb', '.dbg') } |
71+ Copy-Item -Destination { Join-Path ".\temp-release" $_.FullName.Substring("$((Get-Location).Path)\publish\${{ matrix.runtime }}".Length) } -Force
72+ # 创建带版本号的 zip 包 (使用 . 分割)
73+ $zipName = "DotNetCampus.Terminal.${{ matrix.runtime }}.${{ steps.get_version.outputs.version }}.zip"
74+ Compress-Archive -Path ".\temp-release\*" -DestinationPath ".\$zipName"
75+ echo "zip_name=$zipName" >> $env:GITHUB_OUTPUT
7976 shell : pwsh
77+ id : package_windows
8078
81- - name : Create release package (Unix)
79+ - name : Clean debug files and create release package (Unix)
8280 if : matrix.os != 'windows-latest'
8381 run : |
84- # 创建临时文件夹,复制所有发布文件
82+ # 创建临时文件夹
8583 mkdir -p ./temp-release
86- cp -r ./publish/${{ matrix.runtime }}/* ./temp-release/
87- # 创建 zip 包,不包含外层文件夹
88- cd temp-release && zip -r ../${{ matrix.artifact-name }}.zip * && cd ..
84+ # 复制所有发布文件,排除调试文件(macOS 的 .dsym 文件夹也排除)
85+ find ./publish/${{ matrix.runtime }} -type f ! -name "*.pdb" ! -name "*.dbg" ! -path "*.dsym*" -exec cp {} ./temp-release/ \;
86+ # 创建带版本号的 zip 包 (使用 . 分割)
87+ zip_name="DotNetCampus.Terminal.${{ matrix.runtime }}.${{ steps.get_version.outputs.version }}.zip"
88+ cd temp-release && zip -r ../$zip_name * && cd ..
89+ echo "zip_name=$zip_name" >> $GITHUB_OUTPUT
90+ id : package_unix
8991
9092 - name : Upload artifacts
9193 uses : actions/upload-artifact@v4
9294 with :
9395 name : ${{ matrix.artifact-name }}
94- path : ${{ matrix.artifact-name }}.zip
96+ path : ${{ steps.package_windows.outputs.zip_name || steps.package_unix.outputs.zip_name }}
9597 if-no-files-found : error
9698 retention-days : 7
9799
@@ -110,6 +112,16 @@ jobs:
110112 ls -la ./artifacts/
111113 find ./artifacts -type f -name "*.zip" | head -10
112114
115+ - name : Extract version from tag
116+ id : get_version
117+ run : |
118+ # Extract version from tag (remove 'v' prefix if present)
119+ VERSION="${{ github.ref_name }}"
120+ VERSION=${VERSION#v}
121+ echo "version=$VERSION" >> $GITHUB_OUTPUT
122+ echo "Extracted version: $VERSION"
123+ shell : bash
124+
113125 - name : Create GitHub Release
114126 uses : softprops/action-gh-release@v1
115127 with :
@@ -123,35 +135,35 @@ jobs:
123135
124136 | Platform | File | Description |
125137 |----------|------|-------------|
126- | Windows (x64) | `DotNetCampus.Terminal- win-x64.zip` | Windows 64-bit version |
127- | Linux (x64) | `DotNetCampus.Terminal- linux-x64.zip` | Linux 64-bit version |
128- | macOS (x64) | `DotNetCampus.Terminal- osx-x64.zip` | macOS 64-bit version |
138+ | Windows (x64) | `DotNetCampus.Terminal. win-x64.${{ steps.get_version.outputs.version }} .zip` | Windows 64-bit version |
139+ | Linux (x64) | `DotNetCampus.Terminal. linux-x64.${{ steps.get_version.outputs.version }} .zip` | Linux 64-bit version |
140+ | macOS (x64) | `DotNetCampus.Terminal. osx-x64.${{ steps.get_version.outputs.version }} .zip` | macOS 64-bit version |
129141
130142 ### 🔧 Installation
131143
132144 **Windows:**
133145 ```bash
134146 # Extract the zip file
135- # Double-click to run DotNetCampus.Terminal-win-x64 .exe
147+ # Double-click to run DotNetCampus.Terminal.exe
136148 ```
137149
138150 **Linux/macOS:**
139151 ```bash
140152 # Extract the zip file
141153 unzip DotNetCampus.Terminal-*.zip
142154 # Make executable and run
143- chmod +x DotNetCampus.Terminal-*
144- ./DotNetCampus.Terminal-*
155+ chmod +x DotNetCampus.Terminal
156+ ./DotNetCampus.Terminal
145157 ```
146158
147159 ### 📝 What's Changed
148160
149161 See [CHANGELOG.md](https://github.com/dotnet-campus/DotNetCampus.Terminal/blob/main/CHANGELOG.md) for detailed changes.
150162
151163 files : |
152- ./artifacts/DotNetCampus.Terminal-win-x64/DotNetCampus.Terminal- win-x64.zip
153- ./artifacts/DotNetCampus.Terminal-linux-x64/DotNetCampus.Terminal- linux-x64.zip
154- ./artifacts/DotNetCampus.Terminal-osx-x64/DotNetCampus.Terminal- osx-x64.zip
164+ ./artifacts/DotNetCampus.Terminal-win-x64/DotNetCampus.Terminal. win-x64.${{ steps.get_version.outputs.version }} .zip
165+ ./artifacts/DotNetCampus.Terminal-linux-x64/DotNetCampus.Terminal. linux-x64.${{ steps.get_version.outputs.version }} .zip
166+ ./artifacts/DotNetCampus.Terminal-osx-x64/DotNetCampus.Terminal. osx-x64.${{ steps.get_version.outputs.version }} .zip
155167 draft : false
156168 prerelease : ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
157169 env :
0 commit comments