更新Upm.bat脚本以支持UTF-8编码,添加分支管理和强制推送功能,同时将版本号更新至1.3.6。

This commit is contained in:
2025-03-13 18:05:30 +08:00
parent 0171d63c21
commit 7370d9cfcf
2 changed files with 35 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
"name": "com.commercialization.topon",
"displayName": "Commercialization.topon",
"description": "基于topon的广告sdk封装依赖基础商业化模块",
"version": "1.3.5",
"version": "1.3.6",
"unity": "2021.1",
"license": "MIT",
"repository": {

View File

@@ -1,19 +1,24 @@
@echo off
chcp 936
:: Set UTF-8 encoding
chcp 65001
:: Set window title
title UPM Package Update Tool
:: Set console color
color a
echo 开始提交到git upm....
echo 提交upm前请确保当前分支所有改动都已经提交
:: 使用 findstr 从 package.json 中提取版本号
:: Extract version from package.json
for /f "tokens=2 delims=:, " %%i in ('findstr "version" Assets\package.json') do (
set version=%%i
)
:: 移除引号
:: Remove quotes
set version=%version:"=%
echo 从package.json中读取的版本号为%version%
:: 检查tag是否已存在
:: Check if tag exists
git tag | findstr "%version%" > nul
if %errorlevel% equ 0 (
echo 错误:版本号 %version% 对应的tag已存在
@@ -25,9 +30,33 @@ set /p Flg=确认提交的版本号%version%,是否开始提交(y/n) --------
IF "%Flg%" equ "y" (
echo 开始提交,请勿关闭该窗口!
:: Delete local upm branch if exists
git branch -D upm 2>nul
:: Create new upm branch from current Assets folder
git subtree split --prefix=Assets --branch upm
:: Force update local upm branch with remote changes
git fetch origin upm
git checkout upm
git reset --hard origin/upm
:: Create new subtree split
git checkout master
git subtree split --prefix=Assets --branch upm-temp
:: Apply new changes and force push
git checkout upm
git merge upm-temp --allow-unrelated-histories -X theirs
git branch -D upm-temp
:: Create and push tag
git tag %version% upm
git push origin upm --tags
git push -f origin upm --tags
:: Return to original branch
git checkout master
GOTO :END
)