The Windows installer for Fastn is built using NSIS (Nullsoft Scriptable Install System), a popular tool for creating Windows installers. NSIS is configured using its own scripting language. The configuration script is named install.nsi
and can be found in the root folder. Some changes were made in the release.yml
, which are mentioned below. Additionally, an icon for the installer named fastn.ico
was added to the root folder.
- Updated the
release.yml
file to incorporate Windows installer support for the Fastn executable. - Integrated NSIS into the build process using the
makensis
GitHub Action. This action allows the execution of NSIS scripts during the build workflow. - Added the
install.nsi
script to the root folder of the Fastn project. This script configures the NSIS installer. - Some other important details:
- The installer uses the NSIS MUI.
- The color scheme is set to a dark color scheme to match the color scheme of the Fastn website:
!define MUI_INSTFILESPAGE_COLORS "FFFFFF 000000" !define MUI_BGCOLOR 000000 !define MUI_TEXTCOLOR ffffff
- The default icon is replaced with
fastn.ico
.
!define MUI_ICON "fastn.ico"
- We are using version 3 of NSIS.
The Fastn installer performs the following tasks:
- Shows a Welcome and License Page.
- Extracts all necessary files to either the default location (Program Files) or a user-defined folder.
- Checks if the required path variable is already set up on the system. If not, it automatically configures the correct path variable to ensure seamless execution of Fastn without any issues.
The following code in the release-windows
job is responsible for building the installer from the executable built by cargo
in the previous step:
- name: Download EnVar Plugin for NSIS
uses: carlosperate/[email protected]
with:
file-url: https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip
file-name: envar_plugin.zip
location: ${{ github.workspace }}
- name: Extract EnVar plugin
run: 7z x -o"${{ github.workspace }}/NSIS_Plugins" "${{ github.workspace }}/envar_plugin.zip"
- name: Create installer
uses: joncloud/makensis-action@v4
with:
arguments: /V3 /DCURRENT_WD=${{ github.workspace }} /DVERSION=${{ github.event.inputs.releaseTag }}
additional-plugin-paths: ${{ github.workspace }}/NSIS_Plugins/Plugins
- uses: actions/upload-artifact@v2
with:
name: windows_x64_installer.exe
path: windows_x64_installer.exe
Explanation:
- Download the EnVar Plugin for NSIS, which is required for correctly configuring path variables in Windows.
- Extract the plugin to the appropriate location.
- Create the installer executable by specifying the following inputs:
CURRENT_WD
: The current Github Working Directory.VERSION
: The release tag.
In the create-release
job, we download the windows_x64_installer.exe
artifact and rename it to fastn_setup
. In the next step, it is added to the artifacts
list as part of the files to be released.