-
Notifications
You must be signed in to change notification settings - Fork 6
/
BuildWindowsPackages.bat
86 lines (74 loc) · 2.54 KB
/
BuildWindowsPackages.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@echo off
set APP_NAME=AutoUpdater.Avalonia
set RID_LIST=win-arm64 win-x64 win-x86
set CONFIG=Release
set FRAMEWORK=net8.0
set SELF_CONTAINED=true
set TRIM_ASSEMBLIES=true
set READY_TO_RUN=false
set ERRORLEVEL=0
echo ********** Start building %APP_NAME% **********
REM Create base directory
IF not exist Packages (
echo Create directory 'Packages'
mkdir Packages
if %ERRORLEVEL% neq 0 (
exit
)
)
REM Get current version
dotnet run --project PackagingTool get-current-version %APP_NAME%\%APP_NAME%.csproj > Packages\Packaging.txt
if %ERRORLEVEL% neq 0 (
del /Q Packages\Packaging.txt
exit
)
set /p CURRENT_VERSION=<Packages\Packaging.txt
echo Version: %CURRENT_VERSION%
REM Get previous version
dotnet run --project PackagingTool get-previous-version %APP_NAME%\%APP_NAME%.csproj > Packages\Packaging.txt
if %ERRORLEVEL% neq 0 (
del /Q Packages\Packaging.txt
exit
)
set /p PREVIOUS_VERSION=<Packages\Packaging.txt
if [%PREVIOUS_VERSION%] neq [] (
echo Previous version: %PREVIOUS_VERSION%
)
REM Create output directory
if not exist Packages\%CURRENT_VERSION% (
echo Create directory 'Packages\%CURRENT_VERSION%'
mkdir Packages\%CURRENT_VERSION%
)
REM Build packages
(for %%r in (%RID_LIST%) do (
REM Start building slf-contained package
echo .
echo [%%r]
echo .
REM Clear project
if exist %APP_NAME%\bin\%CONFIG%\%FRAMEWORK%\%%r\publish (
echo Delete output directory '%APP_NAME%\bin\%CONFIG%\%FRAMEWORK%\%%r\publish'
rmdir %APP_NAME%\bin\%CONFIG%\%FRAMEWORK%\%%r\publish /s /q
)
REM Build project
dotnet publish %APP_NAME% -c %CONFIG% -r %%r --self-contained %SELF_CONTAINED% -p:PublishTrimmed=%TRIM_ASSEMBLIES% -p:PublishReadyToRun=%READY_TO_RUN%
if %ERRORLEVEL% neq 0 (
echo Failed to build project: %ERRORLEVEL%
del /Q Packages\Packaging.txt
exit
)
if exist %APP_NAME%\bin\%CONFIG%\%FRAMEWORK%\%%r\publish\ULogViewer.png (
del /Q %APP_NAME%\bin\%CONFIG%\%FRAMEWORK%\%%r\publish\ULogViewer.png
)
REM Generate package
start /Wait PowerShell -NoLogo -Command Compress-Archive -Force -Path %APP_NAME%\bin\%CONFIG%\%FRAMEWORK%\%%r\publish\* -DestinationPath Packages\%CURRENT_VERSION%\%APP_NAME%-%CURRENT_VERSION%-%%r.zip
if %ERRORLEVEL% neq 0 (
echo Failed to generate package: %ERRORLEVEL%
del /Q Packages\Packaging.txt
exit
)
))
REM Generate package manifest
REM dotnet run --project PackagingTool create-package-manifest win %APP_NAME% %CURRENT_VERSION%
REM Complete
del /Q Packages\Packaging.txt