From 7370d9cfcfff8c23d04f9e3310eb3f7a4122848b Mon Sep 17 00:00:00 2001 From: Foldcc_b1 Date: Thu, 13 Mar 2025 18:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Upm.bat=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81UTF-8=E7=BC=96=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E6=94=AF=E7=AE=A1=E7=90=86=E5=92=8C?= =?UTF-8?q?=E5=BC=BA=E5=88=B6=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=B0=86=E7=89=88=E6=9C=AC=E5=8F=B7=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=87=B31.3.6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/package.json | 2 +- Update Upm.bat | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Assets/package.json b/Assets/package.json index 73d74d2..68e8d2b 100644 --- a/Assets/package.json +++ b/Assets/package.json @@ -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": { diff --git a/Update Upm.bat b/Update Upm.bat index acd00f0..8117725 100644 --- a/Update Upm.bat +++ b/Update Upm.bat @@ -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 )