diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3869537..1c1040f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,15 @@ jobs: - name: 构建(Windows) run: pnpm build:win + - name: 清理 unpacked 目录 + shell: pwsh + run: | + if (Test-Path dist) { + Get-ChildItem -Path dist -Directory -ErrorAction SilentlyContinue | + Where-Object { $_.Name -like '*unpacked*' } | + ForEach-Object { Remove-Item -Recurse -Force $_.FullName } + } + - uses: actions/upload-artifact@v4 with: name: dist-win @@ -112,6 +121,9 @@ jobs: - name: 构建(macOS) run: pnpm -s build:mac + - name: 清理 unpacked 目录 + run: rm -rf dist/*unpacked* + - uses: actions/upload-artifact@v4 with: name: dist-mac @@ -141,6 +153,9 @@ jobs: - name: 构建(Linux) run: pnpm -s build:linux + - name: 清理 unpacked 目录 + run: rm -rf dist/*unpacked* + - uses: actions/upload-artifact@v4 with: name: dist-linux @@ -170,6 +185,20 @@ jobs: - name: 构建(dir) run: pnpm -s build:unpack + - name: 打包并移除 unpacked 目录 + shell: pwsh + run: | + if (Test-Path dist) { + $dirs = Get-ChildItem -Path dist -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -like '*unpacked*' } + foreach ($d in $dirs) { + $zipBase = ($d.Name -replace 'unpacked', 'dir') + $zipPath = Join-Path dist "$zipBase.zip" + if (Test-Path $zipPath) { Remove-Item -Force $zipPath } + Compress-Archive -Path (Join-Path $d.FullName '*') -DestinationPath $zipPath -Force + Remove-Item -Recurse -Force $d.FullName + } + } + - uses: actions/upload-artifact@v4 with: name: dist-unpack @@ -184,6 +213,12 @@ jobs: with: path: artifacts + - name: 清理 unpacked 目录 + run: | + if [ -d artifacts ]; then + find artifacts -type d -name '*unpacked*' -prune -exec rm -rf {} + + fi + - name: 发布 Release uses: softprops/action-gh-release@v2 with: