更新 #55
Workflow file for this run
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: release | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| inputs: | |
| build_macos: | |
| description: '打包 macOS 双架构' | |
| type: boolean | |
| default: false | |
| build_macos_nosr: | |
| description: '打包 macOS 双架构 (无图片超分)' | |
| type: boolean | |
| default: false | |
| build_windows: | |
| description: '打包 Windows x64' | |
| type: boolean | |
| default: true | |
| build_windows_nosr: | |
| description: '打包 Windows x64 (无图片超分)' | |
| type: boolean | |
| default: false | |
| build_windows7: | |
| description: '打包 Windows7 x64 专用' | |
| type: boolean | |
| default: false | |
| build_windows7_nosr: | |
| description: '打包 Windows7 x64 专用 (无图片超分)' | |
| type: boolean | |
| default: false | |
| build_linux_arm64_nosr: | |
| description: '打包 Linux ARM64 (无图片超分)' | |
| type: boolean | |
| default: false | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| PACKAGE_PREFIX: ${{ steps.get-package_prefix.outputs.PACKAGE_PREFIX }} | |
| TAG_NAME: ${{ steps.get-package_prefix.outputs.TAG_NAME }} | |
| HEAD_SHA_SHORT: ${{ steps.get-package_prefix.outputs.HEAD_SHA_SHORT }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: '0' | |
| - name: get-package_prefix | |
| id: get-package_prefix | |
| run: | | |
| LIB_NAME=bika | |
| TAG_NAME=$(git describe --abbrev=0 --tags) | |
| HEAD_SHA_SHORT=$(git rev-parse --short HEAD) | |
| echo "::set-output name=PACKAGE_PREFIX::${LIB_NAME}_${TAG_NAME}" | |
| echo "::set-output name=TAG_NAME::${TAG_NAME}" | |
| echo "::set-output name=HEAD_SHA_SHORT::${HEAD_SHA_SHORT}" | |
| release: | |
| needs: [setup] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| Up_Url: ${{ steps.create_release.outputs.upload_url }} | |
| steps: | |
| - name: create_release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ needs.setup.outputs.TAG_NAME }} | |
| release_name: ${{ needs.setup.outputs.TAG_NAME }} | |
| draft: true | |
| prerelease: true | |
| macos: | |
| if: github.event_name == 'push' || github.event.inputs.build_macos == 'true' | |
| needs: [setup, release] | |
| runs-on: macos-latest | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_macos_universal2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install sr-vulkan | |
| pip install sr-vulkan-model-waifu2x | |
| pip install sr-vulkan-model-realcugan | |
| pip install sr-vulkan-model-realesrgan | |
| cd script | |
| pip install delocate wheel_filename | |
| python build_universal2.py pillow | |
| pip install *.whl | |
| cd .. | |
| pip install -r src/requirements_macos.txt | |
| brew install create-dmg | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| rm -rf book.db | |
| wget https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db | |
| cd .. | |
| cp ../res/icon/Icon.icns ./ | |
| pyinstaller --target-architecture=universal2 --clean --onedir --name PicACG \ | |
| --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ | |
| --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ | |
| --hidden-import config \ | |
| --hidden-import component \ | |
| --hidden-import server \ | |
| --hidden-import task \ | |
| --hidden-import tools \ | |
| --hidden-import view \ | |
| --strip --windowed -i Icon.icns \ | |
| start.py | |
| cp -avf db dist/PicACG.app/Contents/Frameworks | |
| xattr -cr dist/PicACG.app | |
| create-dmg --volname "PicACG" --volicon "Icon.icns" --icon "PicACG.app" 200 190 \ | |
| --window-pos 200 120 \ | |
| --window-size 800 400 \ | |
| --icon-size 100 \ | |
| --hide-extension "PicACG.app" --app-drop-link 600 185 \ | |
| ${{ env.PACKAGENAME }}.dmg dist/PicACG.app | |
| zip -9 bika.zip ${{ env.PACKAGENAME }}.dmg | |
| mv ${{ env.PACKAGENAME }}.dmg .. | |
| mv bika.zip .. | |
| cd .. | |
| - name: upload-macos-artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.dmg | |
| - name: upload-macos | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.dmg | |
| asset_name: ${{ env.PACKAGENAME }}.dmg | |
| asset_content_type: application/gzip | |
| macos-nosr: | |
| if: github.event_name == 'push' || github.event.inputs.build_macos_nosr == 'true' | |
| needs: [setup, release] | |
| runs-on: macos-latest | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_macos_universal2_nosr | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| cd script | |
| pip install delocate wheel_filename | |
| python build_universal2.py pillow | |
| pip install *.whl | |
| cd .. | |
| pip install -r src/requirements_macos.txt | |
| brew install create-dmg | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| rm -rf book.db | |
| wget https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db | |
| cd .. | |
| cp ../res/icon/Icon.icns ./ | |
| pyinstaller --target-architecture=universal2 --clean --onedir --name PicACG \ | |
| --hidden-import sr_ncnn_vulkan --hidden-import PySide6 --hidden-import requests \ | |
| --hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \ | |
| --hidden-import config \ | |
| --hidden-import component \ | |
| --hidden-import server \ | |
| --hidden-import task \ | |
| --hidden-import tools \ | |
| --hidden-import view \ | |
| --strip --windowed -i Icon.icns \ | |
| start.py | |
| cp -avf db dist/PicACG.app/Contents/Frameworks | |
| xattr -cr dist/PicACG.app | |
| create-dmg --volname "PicACG" --volicon "Icon.icns" --icon "PicACG.app" 200 190 \ | |
| --window-pos 200 120 \ | |
| --window-size 800 400 \ | |
| --icon-size 100 \ | |
| --hide-extension "PicACG.app" --app-drop-link 600 185 \ | |
| ${{ env.PACKAGENAME }}.dmg dist/PicACG.app | |
| zip -9 bika.zip ${{ env.PACKAGENAME }}.dmg | |
| mv ${{ env.PACKAGENAME }}.dmg .. | |
| mv bika.zip .. | |
| cd .. | |
| - name: upload-macos-artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.dmg | |
| - name: upload-macos | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.dmg | |
| asset_name: ${{ env.PACKAGENAME }}.dmg | |
| asset_content_type: application/gzip | |
| windows: | |
| if: github.event_name == 'push' || github.event.inputs.build_windows == 'true' | |
| needs: [setup, release] | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows_x64 | |
| EXE_NAME: PicACG.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install nuitka | |
| pip install sr-vulkan | |
| pip install sr-vulkan-model-waifu2x | |
| pip install sr-vulkan-model-realcugan | |
| pip install sr-vulkan-model-realesrgan | |
| pip install -r src\requirements.txt | |
| Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v5.0.1/upx-5.0.1-win64.zip" -OutFile "upx.zip" | |
| Expand-Archive -Path "upx.zip" -DestinationPath "D:\" | |
| Remove-Item "upx.zip" | |
| - name: Build | |
| run: | | |
| cd src | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "db\book.db" | |
| Copy-Item ..\res\icon\icon.ico . | |
| python -m nuitka ` | |
| --onefile ` | |
| --onefile-no-compression ` | |
| --output-dir=dist ` | |
| --output-filename=PicACG ` | |
| --windows-console-mode=disable ` | |
| --msvc=latest ` | |
| --clang ` | |
| --assume-yes-for-downloads ` | |
| --windows-icon-from-ico=icon.ico ` | |
| --plugin-enable=pyside6,upx --upx-binary="D:\upx-5.0.1-win64" ` | |
| start.py | |
| $pkg = "bika" | |
| Remove-Item -Recurse -Force $pkg -ErrorAction SilentlyContinue | |
| New-Item $pkg -ItemType Directory | |
| Move-Item "dist\$env:EXE_NAME" "$pkg\start.exe" | |
| Copy-Item -Recurse db $pkg\ | |
| Copy-Item ..\LICENSE $pkg\ | |
| Copy-Item ..\CHANGELOG $pkg\ | |
| 7z a -t7z -mx9 "$env:PACKAGENAME.7z" $pkg | |
| Move-Item "${env:PACKAGENAME}.7z" ..\ | |
| cd .. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.7z | |
| - name: upload-win | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.7z | |
| asset_name: ${{ env.PACKAGENAME }}.7z | |
| asset_content_type: application/x-7z-compressed | |
| windows-nosr: | |
| if: github.event_name == 'push' || github.event.inputs.build_windows_nosr == 'true' | |
| needs: [setup, release] | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows_x64_nosr | |
| EXE_NAME: PicACG.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install nuitka | |
| pip install -r src\requirements.txt | |
| Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v5.0.1/upx-5.0.1-win64.zip" -OutFile "upx.zip" | |
| Expand-Archive -Path "upx.zip" -DestinationPath "D:\" | |
| Remove-Item "upx.zip" | |
| - name: Build | |
| run: | | |
| cd src | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "db\book.db" | |
| Copy-Item ..\res\icon\icon.ico . | |
| python -m nuitka ` | |
| --onefile ` | |
| --output-dir=dist ` | |
| --onefile-no-compression ` | |
| --output-filename=PicACG ` | |
| --windows-console-mode=disable ` | |
| --msvc=latest ` | |
| --clang ` | |
| --assume-yes-for-downloads ` | |
| --windows-icon-from-ico=icon.ico ` | |
| --plugin-enable=pyside6,upx --upx-binary="D:\upx-5.0.1-win64" ` | |
| start.py | |
| $pkg = "bika" | |
| Remove-Item -Recurse -Force $pkg -ErrorAction SilentlyContinue | |
| New-Item $pkg -ItemType Directory | |
| Move-Item "dist\$env:EXE_NAME" "$pkg\start.exe" | |
| Copy-Item -Recurse db $pkg\ | |
| Copy-Item ..\LICENSE $pkg\ | |
| Copy-Item ..\CHANGELOG $pkg\ | |
| 7z a -t7z -mx9 "$env:PACKAGENAME.7z" $pkg | |
| Move-Item "${env:PACKAGENAME}.7z" ..\ | |
| cd .. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.7z | |
| - name: upload-win | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.7z | |
| asset_name: ${{ env.PACKAGENAME }}.7z | |
| asset_content_type: application/x-7z-compressed | |
| windows7: | |
| if: github.event_name == 'push' || github.event.inputs.build_windows7 == 'true' | |
| needs: [setup, release] | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows7_x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller==4.6 | |
| pip install sr-vulkan | |
| pip install sr-vulkan-model-waifu2x | |
| pip install sr-vulkan-model-realcugan | |
| pip install sr-vulkan-model-realesrgan | |
| pip install -r src\requirements_win7.txt | |
| Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v5.0.1/upx-5.0.1-win64.zip" -OutFile "upx.zip" | |
| Expand-Archive -Path "upx.zip" -DestinationPath "D:\" | |
| Remove-Item "upx.zip" | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| Remove-Item book.db | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "book.db" | |
| cd .. | |
| cp ..\res\icon\icon.ico .\ | |
| pyinstaller -F -w -i icon.ico start.py --upx-dir "D:\upx-5.0.1-win64" | |
| mv dist bika | |
| Copy-Item -Verbose -Recurse -Path db -Destination bika/ | |
| cp ..\LICENSE bika\ | |
| cp ..\CHANGELOG bika\ | |
| cd .. | |
| mkdir ${{ env.PACKAGENAME }} | |
| mv src\bika ${{ env.PACKAGENAME }} | |
| 7z a -t7z -mx9 "$Env:PACKAGENAME.7z" "$Env:PACKAGENAME" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.7z | |
| - name: upload-win | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.7z | |
| asset_name: ${{ env.PACKAGENAME }}.7z | |
| asset_content_type: application/zip | |
| windows7-nosr: | |
| if: github.event_name == 'push' || github.event.inputs.build_windows7_nosr == 'true' | |
| needs: [setup, release] | |
| runs-on: windows-latest | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows7_x64_nosr | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller==4.6 | |
| pip install -r src\requirements_win7.txt | |
| Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v5.0.1/upx-5.0.1-win64.zip" -OutFile "upx.zip" | |
| Expand-Archive -Path "upx.zip" -DestinationPath "D:\" | |
| Remove-Item "upx.zip" | |
| - name: Build | |
| run: | | |
| cd src | |
| cd db | |
| Remove-Item book.db | |
| Invoke-WebRequest -Uri "https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db" -OutFile "book.db" | |
| cd .. | |
| cp ..\res\icon\icon.ico .\ | |
| pyinstaller -F -w -i icon.ico start.py --upx-dir "D:\upx-5.0.1-win64" | |
| mv dist bika | |
| Copy-Item -Verbose -Recurse -Path db -Destination bika/ | |
| cp ..\LICENSE bika\ | |
| cp ..\CHANGELOG bika\ | |
| cd .. | |
| mkdir ${{ env.PACKAGENAME }} | |
| mv src\bika ${{ env.PACKAGENAME }} | |
| 7z a -t7z -mx9 "$Env:PACKAGENAME.7z" "$Env:PACKAGENAME" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.7z | |
| - name: upload-win | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.7z | |
| asset_name: ${{ env.PACKAGENAME }}.7z | |
| asset_content_type: application/zip | |
| linux-arm64-nosr: | |
| if: github.event_name == 'push' || github.event.inputs.build_linux_arm64_nosr == 'true' | |
| needs: [setup, release] | |
| runs-on: ubuntu-24.04-arm | |
| env: | |
| PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_linux_arm64_nosr | |
| BINARY_NAME: bika | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build with Nuitka | |
| run: | | |
| docker run --rm --platform linux/arm64 \ | |
| -v "$PWD":/workspace -w /workspace/src \ | |
| cyberspace0000/linux-arm-py10:1 sh -exc ' | |
| source /opt/miniforge/bin/activate | |
| conda activate py310 | |
| pip3 install --upgrade nuitka | |
| UPX_VER=5.0.1 | |
| curl -L -o /tmp/upx.tar.xz \ | |
| "https://github.com/upx/upx/releases/download/v${UPX_VER}/upx-${UPX_VER}-arm64_linux.tar.xz" | |
| mkdir -p /tmp/upx | |
| tar -xf /tmp/upx.tar.xz -C /tmp/upx --strip-components=1 | |
| export UPX_BIN=/tmp/upx/upx | |
| chmod +x "$UPX_BIN" | |
| grep -v -i "^pyside6" requirements.txt > /tmp/requirements.txt | |
| pip3 install -r /tmp/requirements.txt | |
| mkdir -p db | |
| curl -L -o db/book.db \ | |
| https://github.com/bika-robot/picacg-database/releases/download/v1.5.3/book.db | |
| nuitka start.py \ | |
| --onefile --output-dir=dist --static-libpython=yes \ | |
| --onefile-no-compression \ | |
| --plugin-enable=pyside6,upx --upx-binary="$UPX_BIN" \ | |
| --assume-yes-for-downloads \ | |
| --linux-icon=../res/icon/icon.ico | |
| mkdir -p /workspace/out | |
| mv dist/start.bin "/workspace/out/${BINARY_NAME}/start" | |
| cp -r db /workspace/out/ | |
| cp ../LICENSE /workspace/out/ | |
| cp ../CHANGELOG /workspace/out/ | |
| chown -R 1001:1001 /workspace | |
| ' | |
| - name: Create 7z archive | |
| run: | | |
| rm -rf src/dist src/*.onefile-build | |
| mkdir package | |
| mv out package/bika | |
| cd package | |
| 7z a -t7z -mx9 -r "${{ env.PACKAGENAME }}.7z" bika | |
| mv "${{ env.PACKAGENAME }}.7z" .. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGENAME }} | |
| path: ${{ env.PACKAGENAME }}.7z | |
| - name: Upload release asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.Up_Url }} | |
| asset_path: ${{ env.PACKAGENAME }}.7z | |
| asset_name: ${{ env.PACKAGENAME }}.7z | |
| asset_content_type: application/zip |