Compare commits

...

2 Commits

Author SHA1 Message Date
yyhuni
6d5c776bf7 chore: improve version detection and update deployment configuration
- Update version detection to support IMAGE_TAG environment variable for Docker containers
- Add fallback mechanism to check multiple version file paths (/app/VERSION and project root)
- Add IMAGE_TAG environment variable to docker-compose.dev.yml and docker-compose.yml
- Fix frontend access URL in start.sh to include correct port (8083)
- Update upgrade warning message in update.sh to recommend fresh installation with latest code
- Improve robustness of version retrieval with better error handling for missing files
2026-01-10 10:41:36 +08:00
github-actions[bot]
bf058dd67b chore: bump version to v1.5.6-dev 2026-01-10 02:33:15 +00:00
6 changed files with 27 additions and 8 deletions

View File

@@ -1 +1 @@
v1.5.4-dev
v1.5.6-dev

View File

@@ -23,11 +23,26 @@ GITHUB_RELEASES_URL = f"https://github.com/{GITHUB_REPO}/releases"
def get_current_version() -> str:
"""读取当前版本号"""
version_file = Path(__file__).parent.parent.parent.parent.parent / 'VERSION'
try:
return version_file.read_text(encoding='utf-8').strip()
except FileNotFoundError:
return "unknown"
import os
# 方式1从环境变量读取Docker 容器中推荐)
version = os.environ.get('IMAGE_TAG', '')
if version:
return version
# 方式2从文件读取开发环境
possible_paths = [
Path('/app/VERSION'),
Path(__file__).parent.parent.parent.parent.parent / 'VERSION',
]
for path in possible_paths:
try:
return path.read_text(encoding='utf-8').strip()
except (FileNotFoundError, OSError):
continue
return "unknown"
def compare_versions(current: str, latest: str) -> bool:

View File

@@ -44,6 +44,8 @@ services:
restart: always
env_file:
- .env
environment:
- IMAGE_TAG=${IMAGE_TAG:-dev}
ports:
- "8888:8888"
depends_on:

View File

@@ -48,6 +48,8 @@ services:
restart: always
env_file:
- .env
environment:
- IMAGE_TAG=${IMAGE_TAG}
depends_on:
redis:
condition: service_healthy

View File

@@ -182,7 +182,7 @@ echo -e "${BOLD}${GREEN}══════════════════
echo ""
echo -e "${BOLD}访问地址${NC}"
if [ "$WITH_FRONTEND" = true ]; then
echo -e " XingRin: ${CYAN}https://${ACCESS_HOST}/${NC}"
echo -e " XingRin: ${CYAN}https://${ACCESS_HOST}:8083/${NC}"
echo -e " ${YELLOW}(HTTP 会自动跳转到 HTTPS)${NC}"
else
echo -e " API: ${CYAN}通过前端或 nginx 访问(后端未暴露 8888${NC}"

View File

@@ -94,7 +94,7 @@ echo ""
# 测试性功能警告
echo -e "${BOLD}${YELLOW}[!] 警告:此功能为测试性功能,可能会导致升级失败${NC}"
echo -e "${YELLOW} 建议运行 ./uninstall.sh 后重新执行 ./install.sh 进行全新安装${NC}"
echo -e "${YELLOW} 建议运行 ./uninstall.sh 后重新clone最新代码进行全新安装${NC}"
echo ""
echo -n -e "${YELLOW}是否继续更新?(y/N) ${NC}"
read -r ans_continue