release-win.bat 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. @echo off
  2. chcp 65001 >nul 2>&1
  3. :: ============================================
  4. :: Claude AI Installer Windows 发布脚本
  5. :: Release script for Windows
  6. :: 此脚本作为 scripts/release.js 的简单入口
  7. :: ============================================
  8. :: 切换到脚本所在目录
  9. cd /d "%~dp0"
  10. :: 检查是否请求帮助
  11. if /i "%~1"=="--help" goto :show_help
  12. if /i "%~1"=="-h" goto :show_help
  13. :: 检查 Node.js
  14. where node >nul 2>&1
  15. if errorlevel 1 (
  16. echo [91mx[0m 未找到 Node.js,请先安装 Node.js
  17. pause
  18. exit /b 1
  19. )
  20. :: 检查 node_modules
  21. if not exist "node_modules" (
  22. echo [93m![0m 未找到 node_modules,正在安装依赖...
  23. call npm install
  24. if errorlevel 1 (
  25. echo [91mx[0m 安装依赖失败
  26. pause
  27. exit /b 1
  28. )
  29. )
  30. :: 转换参数并调用 Node.js 脚本
  31. :: release.js 在 Windows 上已默认只构建 win 平台
  32. :: 默认版本类型为 patch
  33. set "NODE_ARGS=patch"
  34. :parse_args
  35. if "%~1"=="" goto :run_release
  36. if /i "%~1"=="patch" set "NODE_ARGS=patch" & shift & goto :parse_args
  37. if /i "%~1"=="minor" set "NODE_ARGS=minor" & shift & goto :parse_args
  38. if /i "%~1"=="major" set "NODE_ARGS=major" & shift & goto :parse_args
  39. if /i "%~1"=="--tag" set "NODE_ARGS=%NODE_ARGS% --tag" & shift & goto :parse_args
  40. if /i "%~1"=="-t" set "NODE_ARGS=%NODE_ARGS% --tag" & shift & goto :parse_args
  41. if /i "%~1"=="--push" set "NODE_ARGS=%NODE_ARGS% --push" & shift & goto :parse_args
  42. if /i "%~1"=="--dry-run" set "NODE_ARGS=%NODE_ARGS% --dry-run" & shift & goto :parse_args
  43. if /i "%~1"=="--platform" set "NODE_ARGS=%NODE_ARGS% --platform %~2" & shift & shift & goto :parse_args
  44. if /i "%~1"=="-p" set "NODE_ARGS=%NODE_ARGS% --platform %~2" & shift & shift & goto :parse_args
  45. shift
  46. goto :parse_args
  47. :run_release
  48. echo.
  49. echo [96m^> 调用 Node.js 发布脚本...[0m
  50. echo [94mi[0m 执行: node scripts/release.js %NODE_ARGS%
  51. echo.
  52. call node scripts/release.js %NODE_ARGS%
  53. if errorlevel 1 (
  54. echo.
  55. echo [91mx[0m 发布失败!
  56. echo.
  57. pause
  58. exit /b 1
  59. )
  60. echo.
  61. pause
  62. goto :eof
  63. :: ============================================
  64. :: 显示帮助信息
  65. :: ============================================
  66. :show_help
  67. echo.
  68. echo Claude AI Installer Windows 发布脚本
  69. echo.
  70. echo 用法:
  71. echo release-win.bat [版本类型] [参数]
  72. echo.
  73. echo 版本类型:
  74. echo patch 补丁版本 +1 (默认, 如: 0.0.1 -^> 0.0.2)
  75. echo minor 次版本 +1 (如: 0.0.1 -^> 0.1.0)
  76. echo major 主版本 +1 (如: 0.0.1 -^> 1.0.0)
  77. echo.
  78. echo 参数:
  79. echo --tag, -t 创建 Git tag
  80. echo --push 推送 tag 到远程仓库 (需要先指定 --tag)
  81. echo --dry-run 仅显示操作,不实际执行
  82. echo --platform, -p 指定平台 (逗号分隔): win,mac,linux
  83. echo --help, -h 显示此帮助信息
  84. echo.
  85. echo 示例:
  86. echo release-win.bat 更新 patch 版本并构建
  87. echo release-win.bat minor 更新 minor 版本并构建
  88. echo release-win.bat patch --tag 更新版本、构建并创建 tag
  89. echo release-win.bat --tag --push 更新版本、构建、创建 tag 并推送
  90. echo release-win.bat --dry-run 预览发布操作
  91. echo.
  92. echo 输出:
  93. echo release\Claude-AI-Installer-x.x.x-win-x64-setup.exe (NSIS 安装程序)
  94. echo release\Claude-AI-Installer-x.x.x-win-x64.exe (便携版)
  95. echo.
  96. echo 注意: 此脚本调用 scripts/release.js 执行实际发布
  97. echo Windows 上默认只构建 win 平台
  98. echo.
  99. goto :eof