Update build_windows_packages.ps1

This commit is contained in:
XXXXRT666 2025-05-20 14:02:20 +01:00 committed by GitHub
parent e30242977b
commit af26bb61a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -155,17 +155,32 @@ $items = @(Get-ChildItem -Filter "*.sh") +
@(Get-ChildItem -Filter "*.ipynb") +
@("$tmpDir", ".github", "Docker", "docs", ".gitignore", ".dockerignore", "README.md")
Remove-Item $items -Force -Recurse -ErrorAction SilentlyContinue
$curr = Get-Location
Set-Location ../
Get-ChildItem .
Copy-Item -Path $curr -Destination $pkgName -Recurse
$7zPath = "$pkgName.7z"
$start = Get-Date
Write-Host "Compress Starting at $start"
& "C:\Program Files\7-Zip\7z.exe" a -t7z "$7zPath" "$pkgName" -m0=lzma2 -mx=9 -md=256m -ms=on -mmt=on -bsp1
$end = Get-Date
Write-Host "Elapsed time: $($end - $start)"
Get-ChildItem .
$config = @"
;!@Install@!UTF-8!
Title="GPT-SoVITS Installation"
BeginPrompt="本软件以MIT协议开源, 作者不对软件具备任何控制力, 使用软件者、传播软件导出的声音者自负全责 / This software is open-sourced under the MIT license. The author has no control over it. Users and distributors of the generated voices are solely responsible."
ExtractPath="."
;!@InstallEnd@!
"@
Set-Content -Path "config.txt" -Value $config -Encoding UTF8
$SfxModule = "C:\Program Files\7-Zip\7z.sfx"
$SfxExePath = "$pkgName.exe"
Write-Host "[INFO] Creating self-extracting archive: $SfxExePath"
cmd /c "copy /b `"$SfxModule`" + config.txt + `"$7zPath`" `"$SfxExePath`""
python -m pip install --upgrade pip
python -m pip install "modelscope" "huggingface_hub[hf_transfer]" --no-warn-script-location
@ -177,9 +192,8 @@ if (-not $msUser -or -not $msToken) {
Write-Error "Missing MODELSCOPE_USERNAME or MODELSCOPE_TOKEN"
exit 1
}
modelscope upload "$msUser/GPT-SoVITS-Packages" "$7zPath" "$7zPath" --repo-type model --token $msToken
Write-Host "[SUCCESS] Uploaded: $7zPath to ModelScope"
modelscope upload "$msUser/GPT-SoVITS-Packages" "$SfxExePath" "$SfxExePath" --repo-type model --token $msToken
Write-Host "[SUCCESS] Uploaded: $SfxExePath to ModelScope"
Write-Host "[INFO] Uploading to HuggingFace..."
$hfUser = $env:HUGGINGFACE_USERNAME
@ -189,6 +203,5 @@ if (-not $hfUser -or -not $hfToken) {
exit 1
}
$env:HF_HUB_ENABLE_HF_TRANSFER = "1"
huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$7zPath" "$7zPath" --repo-type model --token $hfToken
Write-Host "[SUCCESS] Uploaded: $7zPath to HuggingFace"
huggingface-cli upload "$hfUser/GPT-SoVITS-Packages" "$SfxExePath" "$SfxExePath" --repo-type model --token $hfToken
Write-Host "[SUCCESS] Uploaded: $SfxExePath to HuggingFace"