fix build

This commit is contained in:
jxxghp
2023-11-20 19:54:41 +08:00
parent 51536062f1
commit b92b0ec149
2 changed files with 44 additions and 38 deletions

View File

@ -119,7 +119,7 @@ jobs:
name: windows name: windows
path: dist/MoviePilot.exe path: dist/MoviePilot.exe
Linux-build: Linux-build-amd64:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Build Linux Binary name: Build Linux Binary
steps: steps:
@ -140,23 +140,6 @@ jobs:
- name: Prepare Frontend - name: Prepare Frontend
run: | run: |
wget http://nginx.org/download/nginx-1.25.2.zip
unzip nginx-1.25.2.zip
mv nginx-1.25.2 nginx
rm nginx-1.25.2.zip
FRONTEND_VERSION=$(curl -s "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" | jq -r .tag_name)
wget "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/$FRONTEND_VERSION/dist.zip"
unzip dist.zip
mv dist/* nginx/html
rm dist.zip
rm -rf dist
mv nginx/html/nginx.conf nginx/conf/nginx.conf
mkdir -p nginx/temp
touch nginx/temp/__keep__.txt
mkdir -p nginx/logs
touch nginx/logs/__keep__.txt
wget https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip wget https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip
unzip main.zip unzip main.zip
mv MoviePilot-Plugins-main/plugins/* app/plugins/ mv MoviePilot-Plugins-main/plugins/* app/plugins/
@ -172,17 +155,44 @@ jobs:
- name: Pyinstaller - name: Pyinstaller
run: | run: |
pyinstaller frozen.spec pyinstaller frozen.spec
mv dist/MoviePilot dist/MoviePilot_Amd64
- name: Upload Ubuntu File - name: Upload Linux File
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: linux name: linux-amd64
path: dist/MoviePilot path: dist/MoviePilot_Amd64
Linux-build-arm64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Up QEMU
uses: docker/setup-qemu-action@v2
- name: Set Up Buildx
uses: docker/setup-buildx-action@v2
- name: Package through pyinstaller
run: |
mkdir rootfs
docker buildx build --platform linux/arm64 --file ./Dockerfile --build-arg branch=main --output type=local,dest=./rootfs .
mkdir dist
cp ./rootfs/MoviePilot dist/MoviePilot_Arm64
shell: pwsh
- name: Upload Linux File
uses: actions/upload-artifact@v3
with:
name: linux-arm64
path: dist/MoviePilot_Arm64
Create-release: Create-release:
permissions: write-all permissions: write-all
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ Windows-build, Docker-build, Linux-build ] needs: [ Windows-build, Docker-build, Linux-build-amd64, Linux-build-arm64 ]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -199,8 +209,9 @@ jobs:
shell: bash shell: bash
run: | run: |
mkdir releases mkdir releases
mv ./windows/MoviePilot.exe ./releases/MoviePilot_v${{ env.app_version }}.exe mv ./windows/MoviePilot.exe ./releases/MoviePilot_Win_v${{ env.app_version }}.exe
mv ./linux/dist/MoviePilot ./releases/MoviePilot_linux_v${{ env.app_version }} mv ./linux-amd64/dist/MoviePilot_Amd64 ./releases/MoviePilot_Amd64_v${{ env.app_version }}
mv ./linux-arm64/dist/MoviePilot_Arm64 ./releases/MoviePilot_Arm64_v${{ env.app_version }}
- name: Create Release - name: Create Release
id: create_release id: create_release

View File

@ -62,7 +62,9 @@ def start_frontend():
""" """
启动前端服务 启动前端服务
""" """
if not SystemUtils.is_frozen(): # 仅Windows可执行文件支持内嵌nginx
if not SystemUtils.is_frozen() \
or not SystemUtils.is_windows():
return return
# 临时Nginx目录 # 临时Nginx目录
nginx_path = settings.ROOT_PATH / 'nginx' nginx_path = settings.ROOT_PATH / 'nginx'
@ -75,27 +77,20 @@ def start_frontend():
SystemUtils.move(nginx_path, run_nginx_dir) SystemUtils.move(nginx_path, run_nginx_dir)
# 启动Nginx # 启动Nginx
import subprocess import subprocess
if SystemUtils.is_windows(): subprocess.Popen("start nginx.exe",
subprocess.Popen("start nginx.exe", cwd=run_nginx_dir,
cwd=run_nginx_dir, shell=True)
shell=True)
else:
subprocess.Popen("nohup ./nginx &",
cwd=run_nginx_dir,
shell=True)
def stop_frontend(): def stop_frontend():
""" """
停止前端服务 停止前端服务
""" """
if not SystemUtils.is_frozen(): if not SystemUtils.is_frozen() \
or not SystemUtils.is_windows():
return return
import subprocess import subprocess
if SystemUtils.is_windows(): subprocess.Popen(f"taskkill /f /im nginx.exe", shell=True)
subprocess.Popen(f"taskkill /f /im nginx.exe", shell=True)
else:
subprocess.Popen(f"killall nginx", shell=True)
def start_tray(): def start_tray():