Skip to content

Commit 489fdcf

Browse files
committed
ci(build): 优化多平台构建和发布流程
- 调整 zip 文件命名规则,增加平台后缀 - 更新 Release 创建步骤,匹配新的 zip 文件名 - 修复 Linux 平台下 zip 命令的路径问题 - 优化 zip 文件创建和上传逻辑
1 parent 2beed81 commit 489fdcf

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,41 @@ jobs:
143143
"Text2Voice.dmg" \
144144
"dist/"
145145
146+
- name: Zip Artifacts
147+
shell: bash
148+
run: |
149+
echo "Creating zip archive..."
150+
cd dist
151+
if [ "${{ runner.os }}" == "Windows" ]; then
152+
7z a ../Text2Voice-${{ runner.os }}.zip ./*
153+
elif [ "${{ runner.os }}" == "macOS" ]; then
154+
zip -r ../Text2Voice-${{ runner.os }}.zip ./*
155+
else
156+
zip -r ../Text2Voice-${{ runner.os }}.zip ./*
157+
fi
158+
cd ..
159+
# 重命名文件以匹配下载链接
160+
if [ "${{ runner.os }}" == "Windows" ]; then
161+
mv Text2Voice-Windows.zip Text2Voice-windows-latest.zip
162+
elif [ "${{ runner.os }}" == "macOS" ]; then
163+
mv Text2Voice-macOS.zip Text2Voice-macos-latest.zip
164+
else
165+
mv Text2Voice-Linux.zip Text2Voice-ubuntu-latest.zip
166+
fi
167+
ls -la Text2Voice-*.zip
168+
echo "Zip files created:"
169+
for f in Text2Voice-*.zip; do
170+
echo "- $f ($(stat -f%z "$f" 2>/dev/null || stat -c%s "$f") bytes)"
171+
done
172+
173+
- name: Upload Artifacts
174+
uses: actions/upload-artifact@v4
175+
with:
176+
name: Text2Voice-${{ matrix.os }}
177+
path: Text2Voice-${{ matrix.os }}.zip
178+
compression-level: 9
179+
retention-days: 365
180+
146181
- name: Create Release
147182
if: startsWith(github.ref, 'refs/tags/')
148183
uses: softprops/action-gh-release@v2
@@ -168,33 +203,6 @@ jobs:
168203
![下载次数](https://img.shields.io/github/downloads/axdlee/text2voice/${{ github.ref_name }}/total)
169204
draft: false
170205
prerelease: false
171-
files: |
172-
Text2Voice-*.zip
206+
files: Text2Voice-*-latest.zip # 更新文件匹配模式
173207
env:
174-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175-
176-
# 确保压缩步骤在 release 之前执行
177-
- name: Zip Artifacts
178-
shell: bash
179-
run: |
180-
echo "Creating zip archive..."
181-
cd dist
182-
if [ "${{ runner.os }}" == "Windows" ]; then
183-
7z a ../Text2Voice-${{ matrix.os }}.zip ./*
184-
else
185-
zip -r ../Text2Voice-${{ matrix.os }}.zip ./*
186-
fi
187-
cd ..
188-
ls -la Text2Voice-*.zip
189-
echo "Zip files created:"
190-
for f in Text2Voice-*.zip; do
191-
echo "- $f ($(stat -f%z "$f" 2>/dev/null || stat -c%s "$f") bytes)"
192-
done
193-
194-
- name: Upload Artifacts
195-
uses: actions/upload-artifact@v4
196-
with:
197-
name: Text2Voice-${{ matrix.os }}
198-
path: Text2Voice-${{ matrix.os }}.zip
199-
compression-level: 9
200-
retention-days: 365
208+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
您可以从以下位置下载最新版本:
3939

40-
1. [Releases 页面](https://github.com/xdlee110/text2voice/releases) - 稳定版本
41-
2. [Actions 页面](https://github.com/xdlee110/text2voice/actions) - 最新构建版本
40+
1. [Releases 页面](https://github.com/axdlee/text2voice/releases) - 稳定版本
41+
2. [Actions 页面](https://github.com/axdlee/text2voice/actions) - 最新构建版本
4242

4343
### 安装
4444

0 commit comments

Comments
 (0)