-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,8 @@ | |
# App | ||
conf.toml | ||
/release | ||
/tmp | ||
/tmp | ||
/tools | ||
|
||
*.zip | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@echo off | ||
|
||
rem | ||
rem ASSEMBLE DISTRIBUTION PACKAGE | ||
rem | ||
|
||
rem Set the target platform and the path to UPX | ||
set TARGET_PLATFORM=kitsu-file-parser | ||
set UPX_PATH=tools\upx-3.96-win64\upx.exe | ||
|
||
rem Get the current date in the format YYYY-MM-DD | ||
for /f "tokens=1-3 delims=-" %%a in ('powershell -command "Get-Date -Format 'yyyy-MM-dd'"') do set CURRENT_DATE=%%a-%%b-%%c | ||
set OUTPUT_ARCHIVE=dist\kitsu-file-parser-win-v%CURRENT_DATE%.zip | ||
|
||
rem Run build-release.bat | ||
call build-release.bat | ||
if errorlevel 1 ( | ||
echo "Build process failed." | ||
exit /b 1 | ||
) | ||
|
||
rem Create or clear the "dist" directory for the target platform | ||
if exist dist\%TARGET_PLATFORM% rmdir /s /q dist\%TARGET_PLATFORM% | ||
mkdir dist\%TARGET_PLATFORM% | ||
|
||
rem Copy specified files and folders | ||
copy kitsu-file-parser.exe dist\%TARGET_PLATFORM% | ||
copy README.md dist\%TARGET_PLATFORM% | ||
copy LICENSE dist\%TARGET_PLATFORM% | ||
copy empty.conf.toml dist\%TARGET_PLATFORM%\conf.toml | ||
xcopy /E /I /Y assets dist\%TARGET_PLATFORM%\assets | ||
|
||
rem Use UPX packer if available, otherwise download and use it | ||
if not exist %UPX_PATH% ( | ||
echo "UPX not found. Downloading UPX..." | ||
mkdir tools | ||
powershell -command "& { Invoke-WebRequest -Uri 'https://github.com/upx/upx/releases/download/v3.96/upx-3.96-win64.zip' -OutFile 'tools\upx.zip' }" | ||
powershell -command "& { Expand-Archive -Path 'tools\upx.zip' -DestinationPath 'tools' }" | ||
del tools\upx.zip | ||
) | ||
|
||
rem Pack the binary with UPX | ||
%UPX_PATH% --best dist\%TARGET_PLATFORM%\kitsu-file-parser.exe | ||
|
||
rem Create a zip archive with version and current date | ||
powershell -command "& { Compress-Archive -Path 'dist\%TARGET_PLATFORM%' -DestinationPath '%OUTPUT_ARCHIVE%' -Force}" |