build v2 beta

This commit is contained in:
jxxghp
2024-10-22 12:09:57 +08:00
parent 60632aa9d3
commit f3144807bd
4 changed files with 25 additions and 15 deletions

View File

@@ -1,9 +1,14 @@
name: MoviePilot Builder
name: MoviePilot Builder v2
on:
workflow_dispatch:
push:
branches:
- dev
- v2
paths:
- '.github/workflows/build.yml'
- 'Dockerfile'
- 'version.py'
- 'requirements.in'
jobs:
Docker-build:
@@ -23,7 +28,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/moviepilot
images: ${{ secrets.DOCKER_USERNAME }}/moviepilot-v2
tags: |
type=raw,value=${{ env.app_version }}

View File

@@ -79,7 +79,8 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \
&& echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \
&& echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \
&& locale-gen zh_CN.UTF-8 \
&& curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/dev_v2.0.0-alpha/dist.zip" | busybox unzip -d / - \
&& FRONTEND_VERSION=$(grep -oP "(?<=FRONTEND_VERSION\s*=\s*')[^']+" /app/version.py) \
&& curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \
&& mv /dist /public \
&& curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \
&& mv -f /tmp/MoviePilot-Plugins-main/plugins.v2/* /app/app/plugins/ \
@@ -90,4 +91,4 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \
&& rm -rf /tmp/*
EXPOSE 3000
VOLUME [ "/config" ]
ENTRYPOINT [ "/entrypoint" ]
ENTRYPOINT [ "/entrypoint" ]

21
update
View File

@@ -65,7 +65,8 @@ function install_backend_and_download_resources() {
return 1
fi
INFO "安装依赖成功"
frontend_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases/latest" ${CURL_HEADERS} | jq -r .tag_name)
# 从后端文件中读取前端版本号
frontend_version=$(grep -oP "(?<=FRONTEND_VERSION\s*=\s*')[^']+" /tm/App/version.py)
if [[ "${frontend_version}" != *v* ]]; then
WARN "前端最新版本号获取失败,继续启动..."
return 1
@@ -289,21 +290,23 @@ if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}"
fi
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]; then
INFO "Dev 更新模式"
install_backend_and_download_resources "heads/main.zip"
install_backend_and_download_resources "heads/v2.zip"
else
INFO "Release 更新模式"
old_version=$(grep -m -1 "^\s*APP_VERSION\s*=\s*" /app/version.py | tr -d '\r\n' | awk -F'#' '{print $1}' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')
if [[ "${old_version}" == *APP_VERSION* ]]; then
current_version=$(echo "${old_version}" | sed -rn "s/APP_VERSION\s*=\s*['\"](.*)['\"]/\1/gp")
INFO "当前版本号:${current_version}"
new_version=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases/latest" ${CURL_HEADERS} | jq -r .tag_name | tr -d '\r\n')
if [[ "${new_version}" == *v* ]]; then
release_version=${new_version}
INFO "最新版本号:${release_version}"
# 使用版本号比较函数进行比较
compare_versions "${current_version}" "${release_version}"
# 获取所有发布的版本列表并筛选出以v2开头的版本号
releases=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot/releases" ${CURL_HEADERS} | jq -r '.[].tag_name' | grep "^v2\.")
if [ -z "$releases" ]; then
WARN "未找到任何v2.x版本继续启动..."
else
WARN "最新版本号获取失败,继续启动..."
# 找到最新的v2版本
latest_v2=$(echo "$releases" | sort -V | tail -n 1)
INFO "最新的v2.x版本号${latest_v2}"
# 使用版本号比较函数进行比较,并下载最新版本
compare_versions "${current_version}" "${latest_v2}"
fi
else
WARN "当前版本号获取失败,继续启动..."

View File

@@ -1 +1,2 @@
APP_VERSION = 'v2.0.0-alpha'
APP_VERSION = 'v2.0.0-beta'
FRONTEND_VERSION = 'v2.0.0-beta'