Merge branch 'chuanSir123/refactoring-v3-mvp' into refactoring-v3-mvp #162
This file contains 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: Windows Quickstart | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'browser-version-dev' | |
- 'master' | |
- 'dev' | |
- 'refactoring-v3-mvp' | |
pull_request: | |
branches: | |
- 'master' | |
- 'dev' | |
- 'refactoring-v3-mvp' | |
tags: | |
- '**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Windows Quickstart | |
runs-on: Windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Generate files | |
run: | | |
mkdir C:/generated_files | |
mkdir C:/tmp_files | |
echo "Creating folders..." | |
cd C:/generated_files | |
mkdir kirara_ai | |
mkdir ffmpeg | |
cp -r D:\a\chatgpt-mirai-qq-bot\chatgpt-mirai-qq-bot\* C:\generated_files\kirara_ai\ | |
echo "Downloading ffmpeg ..." | |
Invoke-WebRequest https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-7.0.2-essentials_build.7z -OutFile C:/tmp_files/ffmpeg.7z | |
echo "Appreciate the contribution of gyan.dev" | |
7z x C:/tmp_files/ffmpeg.7z -r -oC:/generated_files/ffmpeg | |
echo "Downloading Python3.11 ..." | |
Invoke-WebRequest https://www.python.org/ftp/python/3.11.2/python-3.11.2-embed-amd64.zip -OutFile C:/tmp_files/python.zip | |
7z x C:/tmp_files/python.zip -r -oC:/generated_files/python3.11 | |
echo "Downloading get-pip.py ..." | |
Invoke-WebRequest -URI https://bootstrap.pypa.io/get-pip.py -OutFile C:/generated_files/python3.11/get-pip.py | |
echo "import site" >> C:/generated_files/python3.11/python311._pth | |
echo "Moving files..." | |
mv D:\a\chatgpt-mirai-qq-bot\chatgpt-mirai-qq-bot\.github\quickstarts\windows\ C:/generated_files/files/ | |
echo "Replacing..." | |
dir C:/generated_files/files/scripts/ | |
cp C:/generated_files/files/scripts/初始化.cmd C:/generated_files/ | |
echo "Downloading vc_redist.exe..." | |
Invoke-WebRequest -URI https://aka.ms/vs/17/release/vc_redist.x64.exe -OutFile "C:\generated_files\【语音功能依赖】vc_redist.x64.exe" | |
echo "Downloading packages..." | |
cd C:/generated_files/kirara_ai | |
..\python3.11\python.exe C:/generated_files/python3.11/get-pip.py | |
..\python3.11\python.exe -m pip install -r requirements.txt | |
..\python3.11\python.exe -c exec("""from pycloudflared import try_cloudflare \ntry: try_cloudflare(-1)\nexcept:... """) | |
cd C:/generated_files | |
- name: Download and extract web dist.zip | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# 获取最新的 release 信息 | |
$latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/DarkSkyTeam/chatgpt-for-bot-webui/releases" -Headers @{ Authorization = "Bearer $($env:GH_TOKEN)" } | |
$zipUrl = $latestRelease[0].assets[0].browser_download_url | |
# 下载 dist.zip 文件 | |
Invoke-WebRequest -Uri $zipUrl -OutFile "C:\generated_files\dist.zip" | |
# 解压 dist.zip 文件到 C:/generated_files 目录 | |
Expand-Archive -Path "C:\generated_files\dist.zip" -DestinationPath "C:\generated_files\kirara_ai\web" | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: quickstart-windows-kirara-ai-amd64 | |
path: | | |
C:\generated_files\ | |
- name: Create Release Archive | |
if: startsWith(github.ref, 'refs/tags/') | |
shell: pwsh | |
run: | | |
Write-Host "Creating archive for release..." | |
Compress-Archive -Path C:\generated_files\* -DestinationPath C:\generated_files\quickstart-windows-kirara-ai-amd64.zip | |
- name: Upload compressed files to release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: C:\generated_files\quickstart-windows-kirara-ai-amd64.zip | |
asset_name: Windows-quickstart-kirara-ai-${{ github.ref_name }}.zip | |
tag: ${{ github.ref_name }} | |
overwrite: false | |
body: "quickstart-windows-kirara-ai-amd64.zip 是为 Windows x64 用户准备的快速启动包" |