Search code examples
windowsjenkinsnsis

Building my NSIS installer using Jenkins


I am very new to Jenkins and want it to build a complete .exe. I set the Repository to a personal URL, now Jenkins do read all the files and copies everything to the Jenkins Workspace. My question is what do I insert into the "Execute Windows Batch Command" block in Jenkins so that it would Compile a NSIS script and store the Setup file in a output file. I have done research into Windows Batch Scripting but nothing that could truly help me in this struggle. If I am doing it all wrong I would love some advice to get me on the right track. Here are my current Jenkins codes to read and safe the files from the repository:

1st "Execute Batch Command"

COPY "C:\Program Files (x86)\Jenkins\jobs\Job_name\Path\*.*" "C:\Program Files (x86)\Jenkins\jobs\Job_Name\workspace\Output\Installs" /Y

2nd "Execute Batch Command"

del c:\inetpub\wwwroot\downloads\%SVN_REVISION%\*.* /s /f /q
rmdir "C:\inetpub\wwwroot\downloads\%SVN_REVISION%"
exit 0

3rd "Execute Batch Command"

MKDIR "C:\inetpub\wwwroot\downloads\%SVN_REVISION%"

4th "Execute Batch Command"

COPY "C:\Program Files (x86)\Jenkins\jobs\Job_Name\workspace\Output\Installs" "c:\inetpub\wwwroot\downloads\%SVN_REVISION%" /Y

Now all I want Jenkins to do is open my .nsi script, compile and create the Setup File which then saves in an output folder.


Solution

  • Create new batch command with following:

    path_to_NSIS_folder>\makensis.exe path_to_your_nsi_file

    makensis.exe is a NSIS compiler and all it needs is path to the script file (.nsi).

    When run the script is compiled and (if no errors) reslting setup.exe is created (the output can se set in .nsi file).