Upload build.bat
#3
by
qazinadvee
- opened
build.bat
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
SET INNOSETUP=%CD%\nvm.iss
|
3 |
+
SET ORIG=%CD%
|
4 |
+
REM SET GOPATH=%CD%\src
|
5 |
+
SET GOBIN=%CD%\bin
|
6 |
+
REM Support for older architectures
|
7 |
+
SET GOARCH=386
|
8 |
+
|
9 |
+
REM Cleanup existing build if it exists
|
10 |
+
if exist src\nvm.exe (
|
11 |
+
del src\nvm.exe
|
12 |
+
)
|
13 |
+
|
14 |
+
REM Make the executable and add to the binary directory
|
15 |
+
echo ----------------------------
|
16 |
+
echo Building nvm.exe
|
17 |
+
echo ----------------------------
|
18 |
+
cd .\src
|
19 |
+
go build nvm.go
|
20 |
+
|
21 |
+
REM Group the file with the helper binaries
|
22 |
+
move nvm.exe "%GOBIN%"
|
23 |
+
cd ..\
|
24 |
+
|
25 |
+
REM Codesign the executable
|
26 |
+
echo ----------------------------
|
27 |
+
echo Sign the nvm executable...
|
28 |
+
echo ----------------------------
|
29 |
+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%GOBIN%\nvm.exe"
|
30 |
+
|
31 |
+
for /f %%i in ('"%GOBIN%\nvm.exe" version') do set AppVersion=%%i
|
32 |
+
echo nvm.exe v%AppVersion% built.
|
33 |
+
|
34 |
+
REM Create the distribution folder
|
35 |
+
SET DIST=%CD%\dist\%AppVersion%
|
36 |
+
|
37 |
+
REM Remove old build files if they exist.
|
38 |
+
if exist "%DIST%" (
|
39 |
+
echo ----------------------------
|
40 |
+
echo Clearing old build in %DIST%
|
41 |
+
echo ----------------------------
|
42 |
+
rd /s /q "%DIST%"
|
43 |
+
)
|
44 |
+
|
45 |
+
REM Create the distribution directory
|
46 |
+
mkdir "%DIST%"
|
47 |
+
|
48 |
+
REM Create the "no install" zip version
|
49 |
+
for %%a in ("%GOBIN%") do (buildtools\zip -j -9 -r "%DIST%\nvm-noinstall.zip" "%CD%\LICENSE" %%a\* -x "%GOBIN%\nodejs.ico")
|
50 |
+
|
51 |
+
REM Generate update utility
|
52 |
+
echo ----------------------------
|
53 |
+
echo Generating update utility...
|
54 |
+
echo ----------------------------
|
55 |
+
cd .\updater
|
56 |
+
go build nvm-update.go
|
57 |
+
move nvm-update.exe "%DIST%"
|
58 |
+
cd ..\
|
59 |
+
|
60 |
+
REM Generate the installer (InnoSetup)
|
61 |
+
echo ----------------------------
|
62 |
+
echo Generating installer...
|
63 |
+
echo ----------------------------
|
64 |
+
buildtools\iscc "%INNOSETUP%" "/o%DIST%"
|
65 |
+
|
66 |
+
echo ----------------------------
|
67 |
+
echo Sign the installer
|
68 |
+
echo ----------------------------
|
69 |
+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-setup.exe"
|
70 |
+
|
71 |
+
echo ----------------------------
|
72 |
+
echo Sign the updater...
|
73 |
+
echo ----------------------------
|
74 |
+
buildtools\signtool.exe sign /debug /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a "%DIST%\nvm-update.exe"
|
75 |
+
|
76 |
+
echo ----------------------------
|
77 |
+
echo Bundle the installer...
|
78 |
+
echo ----------------------------
|
79 |
+
buildtools\zip -j -9 -r "%DIST%\nvm-setup.zip" "%DIST%\nvm-setup.exe"
|
80 |
+
|
81 |
+
|
82 |
+
echo ----------------------------
|
83 |
+
echo Bundle the updater...
|
84 |
+
echo ----------------------------
|
85 |
+
buildtools\zip -j -9 -r "%DIST%\nvm-update.zip" "%DIST%\nvm-update.exe"
|
86 |
+
|
87 |
+
del "%DIST%\nvm-update.exe"
|
88 |
+
del "%DIST%\nvm-setup.exe"
|
89 |
+
|
90 |
+
REM Generate checksums
|
91 |
+
echo ----------------------------
|
92 |
+
echo Generating checksums...
|
93 |
+
echo ----------------------------
|
94 |
+
for %%f in ("%DIST%"\*.*) do (certutil -hashfile "%%f" MD5 | find /i /v "md5" | find /i /v "certutil" >> "%%f.checksum.txt")
|
95 |
+
echo complete
|
96 |
+
|
97 |
+
echo ----------------------------
|
98 |
+
echo Cleaning up...
|
99 |
+
echo ----------------------------
|
100 |
+
del "%GOBIN%\nvm.exe"
|
101 |
+
echo complete
|
102 |
+
@REM del %GOBIN%\nvm-update.exe
|
103 |
+
@REM del %GOBIN%\nvm-setup.exe
|
104 |
+
|
105 |
+
echo NVM for Windows v%AppVersion% build completed. Available in %DIST%
|
106 |
+
@echo on
|