[CI] 尝试修复win打包
This commit is contained in:
@@ -146,29 +146,43 @@ jobs:
|
|||||||
- name: 打包Windows发布文件
|
- name: 打包Windows发布文件
|
||||||
run: |
|
run: |
|
||||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||||
|
|
||||||
|
# 确保版本号不为空
|
||||||
$VERSION = $env:VERSION
|
$VERSION = $env:VERSION
|
||||||
$PACKAGE_NAME = "Fig-$VERSION-windows-x86_64"
|
if ([string]::IsNullOrEmpty($VERSION)) {
|
||||||
|
Write-Host "警告:版本号为空,使用默认值 dev-build"
|
||||||
|
$VERSION = "dev-build"
|
||||||
|
}
|
||||||
|
|
||||||
|
$PACKAGE_NAME = "Fig-${VERSION}-windows-x86_64"
|
||||||
|
Write-Host "打包名称: $PACKAGE_NAME"
|
||||||
|
|
||||||
New-Item -ItemType Directory -Force -Path $PACKAGE_NAME
|
New-Item -ItemType Directory -Force -Path $PACKAGE_NAME
|
||||||
|
|
||||||
# 尝试查找可执行文件
|
# 查找可执行文件
|
||||||
if (Test-Path 'build\windows\x86_64\release\Fig.exe') {
|
if (Test-Path 'build\windows\x86_64\release\Fig.exe') {
|
||||||
Copy-Item 'build\windows\x86_64\release\Fig.exe' $PACKAGE_NAME\
|
Copy-Item 'build\windows\x86_64\release\Fig.exe' $PACKAGE_NAME\
|
||||||
} elseif (Test-Path 'build\windows\x86_64\release\Fig') {
|
} elseif (Test-Path 'build\windows\x86_64\release\Fig') {
|
||||||
Copy-Item 'build\windows\x86_64\release\Fig' $PACKAGE_NAME\Fig.exe
|
Copy-Item 'build\windows\x86_64\release\Fig' $PACKAGE_NAME\Fig.exe
|
||||||
} else {
|
} else {
|
||||||
Write-Host '错误:未找到构建输出文件'
|
Write-Host '错误:未找到构建输出文件'
|
||||||
Get-ChildItem -Recurse -Path build -Include 'Fig*' | Select-Object -First 5
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Test-Path 'src\Module\Library') {
|
if (Test-Path 'src\Module\Library') {
|
||||||
Copy-Item -Recurse 'src\Module\Library' $PACKAGE_NAME\
|
Copy-Item -Recurse 'src\Module\Library' $PACKAGE_NAME\
|
||||||
}
|
}
|
||||||
Compress-Archive -Path $PACKAGE_NAME -DestinationPath "$PACKAGE_NAME.zip"
|
|
||||||
$Hash = Get-FileHash "$PACKAGE_NAME.zip" -Algorithm SHA256
|
# 压缩文件
|
||||||
"$($Hash.Hash) $PACKAGE_NAME.zip" | Out-File "$PACKAGE_NAME.sha256" -Encoding UTF8
|
$ZIP_NAME = "$PACKAGE_NAME.zip"
|
||||||
Write-Host "Windows打包完成: $PACKAGE_NAME.zip"
|
Compress-Archive -Path $PACKAGE_NAME -DestinationPath $ZIP_NAME
|
||||||
|
|
||||||
|
# 生成校验文件
|
||||||
|
$Hash = Get-FileHash $ZIP_NAME -Algorithm SHA256
|
||||||
|
"$($Hash.Hash) $ZIP_NAME" | Out-File "$PACKAGE_NAME.sha256" -Encoding UTF8
|
||||||
|
|
||||||
|
Write-Host "Windows打包完成: $ZIP_NAME"
|
||||||
|
|
||||||
- name: 发布Windows版本到Gitea
|
- name: 发布Windows版本到Gitea
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.CI_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user