Build SD WebUI Forge #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build SD WebUI Forge | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/build_sd_webui_forge.yml" | |
# delete: | |
# create: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# UTC 17:00 -> CST (China) 1:00, see https://datetime360.com/cn/utc-cst-china-time/ | |
# https://docs.github.com/zh/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule | |
- cron: '45 17 * * 0' | |
workflow_dispatch: | |
jobs: | |
Build-SD-WebUI-Forge: | |
name: Build SD WebUI Forge | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: List files in the repository | |
shell: pwsh | |
run: | | |
Get-ChildItem -Path "${{ github.workspace }}" -Recurse | |
- name: Launch SD WebUI Installer | |
shell: pwsh | |
env: | |
UV_NO_PROGRESS: 1 | |
run: | | |
& "${{ github.workspace }}/stable_diffusion_webui_installer.ps1" ` | |
-InstallPath "${{ github.workspace }}/sd_webui_forge" ` | |
-BuildMode ` | |
-BuildWithUpdate ` | |
-BuildWithUpdateExtension ` | |
-BuildWithLaunch ` | |
-BuildWitchBranch 3 ` | |
-InstallBranch "sd_webui_forge" ` | |
-NoPreDownloadModel ` | |
-DisablePyPIMirror ` | |
-DisableGithubMirror ` | |
-DisableHuggingFaceMirror ` | |
-PyTorchPackage "torch==2.7.0+cu128 torchvision==0.22.0+cu128 torchaudio==2.7.0+cu128" ` | |
-xFormersPackage "xformers==0.0.30" | |
- name: Install Insightface | |
shell: pwsh | |
env: | |
PIP_NO_WARN_SCRIPT_LOCATION: 0 | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
run: | | |
& "${{ github.workspace }}/sd_webui_forge/python/python.exe" -m pip install insightface | |
- name: Install OpenPose Editor Assets | |
shell: pwsh | |
run: | | |
function Install-OpenPose-Editor-Assets ($temp_path, $install_path) { | |
$url = "https://github.com/huchenlei/sd-webui-openpose-editor/releases/download/v0.3.0/dist.zip" | |
$archive_path = "${temp_path}/dist_archive.zip" | |
$expand_path = "${temp_path}/editor_dist" | |
if (!(Test-Path $temp_path)) { | |
New-Item -ItemType Directory -Path $temp_path -Force | |
} | |
try { | |
Invoke-WebRequest -Uri $url -OutFile $archive_path | |
Expand-Archive -Path $archive_path -DestinationPath $expand_path -Force | |
Move-Item -Path $expand_path -Destination $install_path -Force | |
} | |
catch { | |
Write-Host "安装 OpenPose Editor 资源出现错误: $_" | |
} | |
} | |
Install-OpenPose-Editor-Assets ` | |
"${{ github.workspace }}/temp" ` | |
"${{ github.workspace }}/sd_webui_forge/stable-diffusion-webui/extensions/sd-webui-openpose-editor/dist" | |
- name: Launch to complete dependencies | |
shell: pwsh | |
env: | |
UV_NO_PROGRESS: 1 | |
run: | | |
& "${{ github.workspace }}/sd_webui_forge/launch.ps1" ` | |
-BuildMode ` | |
-DisablePyPIMirror ` | |
-DisableGithubMirror ` | |
-DisableHuggingFaceMirror | |
- name: Install Hanamizuki | |
shell: pwsh | |
run: | | |
. "${{ github.workspace }}/sd_webui_forge/activate.ps1" | |
Install-Hanamizuki | |
- name: Download VAE approx model | |
shell: pwsh | |
run: | | |
$model_list = @( | |
"https://huggingface.co/licyk/sd-vae/resolve/main/vae-approx/model.pt", | |
"https://huggingface.co/licyk/sd-vae/resolve/main/vae-approx/vaeapprox-sd3.pt", | |
"https://huggingface.co/licyk/sd-vae/resolve/main/vae-approx/vaeapprox-sdxl.pt" | |
) | |
$vae_approx_path = "${{ github.workspace }}/sd_webui_forge/stable-diffusion-webui/models/VAE-approx" | |
New-Item -ItemType Directory -Path "$vae_approx_path" -Force | |
ForEach ($url in $model_list) { | |
$filename = Split-Path $url -Leaf | |
$model_path = Join-Path -Path $vae_approx_path -ChildPath $filename | |
if (Test-Path $model_path) { | |
Write-Host "$filename 已存在于 $vae_approx_path" | |
} else { | |
Write-Host "下载 $filename 到 $vae_approx_path 中" | |
Invoke-WebRequest -Uri $url -OutFile $model_path | |
} | |
} | |
- name: Make docs | |
shell: pwsh | |
run: | | |
python "${{ github.workspace }}/.github/make_docs.py" "${{ github.workspace }}/sd_webui_forge" | |
- name: Archive | |
shell: pwsh | |
run: | | |
$build_time = (Get-Date).ToUniversalTime().AddHours(8).ToString("yyyyMMdd") | |
$package_name = "sd_webui_forge_licyk_${build_time}" | |
$protable_name = "${package_name}_nightly.7z" | |
New-Item -ItemType Directory -Path "${{ github.workspace }}/sdnote/portable/nightly" -Force | |
Move-Item -Path "${{ github.workspace }}/sd_webui_forge" -Destination "${{ github.workspace }}/${package_name}" -Force | |
7z a -t7z -bsp1 "${{ github.workspace }}/sdnote/portable/nightly/sd_webui_forge/${protable_name}" "${{ github.workspace }}/${package_name}" | |
- name: Install HuggingFace and ModelScope library | |
shell: pwsh | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
run: | | |
pip install huggingface_hub modelscope | |
- name: Upload to HuggingFace repo | |
shell: pwsh | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
python "${{ github.workspace }}/.github/huggingface_release.py" | |
- name: Upload to ModelScope repo | |
shell: pwsh | |
env: | |
MODELSCOPE_API_TOKEN: ${{ secrets.MODELSCOPE_API_TOKEN }} | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
python "${{ github.workspace }}/.github/modelscope_release.py" |