diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..82871eff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: 打包并发布 📦 +run-name: ${{ github.event.inputs.VERSION}} + +on: + workflow_dispatch: + inputs: + VERSION: + description: '请输入版本号' + required: true + +permissions: + contents: write + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: 下载 Python 3.10 + run: | + # 最简版 Python 3.10 + Start-BitsTransfer "https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip" + Start-BitsTransfer "https://bootstrap.pypa.io/get-pip.py" + Start-BitsTransfer "https://aka.ms/vs/17/release/vc_redist.x64.exe" "(DLL)初始化例程失败时-点我.exe" + 7z e python-3.10.11-embed-amd64.zip -opy310\ + # 使 pip 可安装 + (Get-Content ".\py310\python310._pth") -replace '#import site', 'import site' | Set-Content ".\py310\python310._pth" + .\py310\python.exe get-pip.py + Remove-Item python-3.10.11-embed-amd64.zip + Remove-Item get-pip.py + + - name: 安装CPU依赖 + run: | + .\py310\python.exe -m pip install -r requirements-cpu.txt + + - name: 预下载模型 + run: | + # 修补 download.py 使其可独立运行 + $fileContent = Get-Content ".\utils\download.py" + $fileContent = $fileContent -replace 'from .init import logger, RootPath', 'from loguru import logger' + $fileContent = $fileContent -replace 'DownLoadPath = RootPath / "download"', 'DownLoadPath = Path(__file__).parent / "download"' + Set-Content download.py $fileContent + .\py310\python.exe download.py + Remove-Item download.py + + - name: 打包 + run: | + # 7z压缩 + # 需要start.exe下载地址 + Set-Content "Start.bat" "chcp 65001 & cd /d %~dp0 & .\py310\python.exe main.py & pause" + Copy-Item config.example.yaml config.yaml + 7z a zzzAuto-Onekey.7z .. + + - name: Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ github.event.inputs.VERSION}} CPU一键包 + # tag_name: ${{ github.event.inputs.VERSION}} + body: "使用前务必阅读README!!国内[下载链接](https://mirror.ghproxy.com/https://github.com/sMythicalBird/ZenlessZoneZero-Auto/releases/latest/download/zzzAuto-Onekey.7z)" + # 生成草稿,不会直接发布 + draft: true + # 如果没有目标文件,则失败停止发布 + fail_on_unmatched_files: true + files: | + zzzAuto-Onekey.7z