Skip to content

Commit

Permalink
package scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Dec 2, 2023
1 parent 3990ad9 commit a2addef
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ bld/
# Mine
Tmp/
/packages/
node_modules/
node_modules/

*.zip
54 changes: 54 additions & 0 deletions Scripts/package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@ECHO OFF
chcp 65001


REM 正则获取当前版本号
cd /d ..\BetterGenshinImpact\Core\Config
set "script=Get-Content 'Global.cs' ^| Select-String -Pattern 'Version.*\"(.*)\"' ^| ForEach-Object { $_.Matches.Groups[1].Value }"

for /f "usebackq delims=" %%i in (`powershell -NoLogo -NoProfile -Command ^"%script%^"`) do set version=%%i

echo 文件内版本号为: %version%

REM 检查是否接收到参数b
if "%~1"=="" (
set /p "b=请输入自定义版本号(直接回车使用文件内版本号):"
) else (
set "b=%~1"
)

if "%b%"=="" (
set "b=%version%"
)

set "tmpfolder=%~dp0\BetterGI.v%b%"
set "zipFile=%~dp0\BetterGI.v%b%.zip"


echo 输入版本号为:%tmpfolder%
echo 目标压缩包为:%zipFile%

cd /d %~dp0
cd /d ..\BetterGenshinImpact\bin\x64\Release\net7.0-windows10.0.22621.0

xcopy * "%tmpfolder%" /E /C /I /Y

rd /s /q "%tmpfolder%\runtimes\android"
rd /s /q "%tmpfolder%\runtimes\ios"
rd /s /q "%tmpfolder%\runtimes\linux-arm64"
rd /s /q "%tmpfolder%\runtimes\linux-x64"
rd /s /q "%tmpfolder%\runtimes\osx-arm64"
rd /s /q "%tmpfolder%\runtimes\osx-x64"
rd /s /q "%tmpfolder%\runtimes\win-arm"
rd /s /q "%tmpfolder%\runtimes\win-arm64"
rd /s /q "%tmpfolder%\runtimes\win-x86"
del /s /f /q "%tmpfolder%\runtimes\win-x64\native\opencv_videoio_ffmpeg480_64.dll"
del /s /f /q "%tmpfolder%\User\config.json"

IF EXIST "%zipFile%" ( del /f /s /q "%zipfile%" )

@ECHO ON
powershell -nologo -noprofile -command "Compress-Archive -Path "%tmpfolder%" -DestinationPath "%zipFile%""

rd /s /q %tmpfolder%
pause

0 comments on commit a2addef

Please sign in to comment.