mirror of
https://github.com/plexguide/Huntarr.io.git
synced 2026-02-11 16:50:16 -06:00
Refine NSIS version file path handling in GHA workflow
This commit is contained in:
17
.github/workflows/windows-build-nsis.yml
vendored
17
.github/workflows/windows-build-nsis.yml
vendored
@@ -54,13 +54,24 @@ jobs:
|
||||
# Display current directory structure
|
||||
dir
|
||||
|
||||
# Run NSIS compiler
|
||||
# Prepare version file path
|
||||
$versionContent = Get-Content version.txt -Raw
|
||||
Write-Host "Version from file: $versionContent"
|
||||
& "C:\Program Files (x86)\NSIS\makensis.exe" /DVERSIONFILE="version.txt" distribution/windows/installer/huntarr_installer.nsi
|
||||
$AbsVersionFile = Join-Path -Path $PWD.Path -ChildPath "version.txt"
|
||||
Write-Host "Absolute path for VERSIONFILE: $AbsVersionFile"
|
||||
|
||||
# Prepare arguments for makensis.exe
|
||||
$MakensisArgs = @(
|
||||
"/DVERSIONFILE=${AbsVersionFile}",
|
||||
"distribution\windows\installer\huntarr_installer.nsi"
|
||||
)
|
||||
|
||||
# Run NSIS compiler
|
||||
Write-Host "Running makensis.exe with arguments: $MakensisArgs"
|
||||
& "C:\Program Files (x86)\NSIS\makensis.exe" $MakensisArgs
|
||||
|
||||
# Check if installer was created
|
||||
$installerPath = "installer/Huntarr_Setup.exe"
|
||||
$installerPath = "installer\Huntarr_Setup.exe"
|
||||
if (Test-Path $installerPath) {
|
||||
Write-Host "Installer created successfully at $installerPath"
|
||||
} else {
|
||||
|
||||
@@ -4,18 +4,35 @@
|
||||
!include "FileFunc.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
; Set a default version in case the file read fails
|
||||
!define DEFAULT_VERSION "1.0.0"
|
||||
!verbose 4 ; Increase verbosity for debugging defines
|
||||
!define DEFAULT_VERSION "1.0.0-default"
|
||||
|
||||
; Try to read version from file
|
||||
!ifdef VERSIONFILE
|
||||
!define /file VERSION "${VERSIONFILE}"
|
||||
!searchreplace VERSION "${VERSION}" "\n" ""
|
||||
!searchreplace VERSION "${VERSION}" "\r" ""
|
||||
!echo "VERSIONFILE is defined by command line as: '${VERSIONFILE}'"
|
||||
!if ${FileExists} "${VERSIONFILE}"
|
||||
!define /file VERSION "${VERSIONFILE}"
|
||||
!searchreplace VERSION "${VERSION}" "\n" ""
|
||||
!searchreplace VERSION "${VERSION}" "\r" ""
|
||||
!echo "Successfully read version '${VERSION}' from '${VERSIONFILE}'"
|
||||
!else
|
||||
!error "VERSIONFILE was defined as '${VERSIONFILE}', but this file was NOT FOUND! Using default version."
|
||||
!define VERSION "${DEFAULT_VERSION}" ; Fallback
|
||||
!endif
|
||||
!else
|
||||
!define VERSION "${DEFAULT_VERSION}"
|
||||
!warning "VERSIONFILE was NOT defined on the command line. Trying relative 'version.txt'."
|
||||
!if ${FileExists} "version.txt" ; Relative to script path, or project root if lucky
|
||||
!define /file VERSION "version.txt"
|
||||
!searchreplace VERSION "${VERSION}" "\n" ""
|
||||
!searchreplace VERSION "${VERSION}" "\r" ""
|
||||
!echo "Successfully read version '${VERSION}' from relative 'version.txt'"
|
||||
!else
|
||||
!warning "Relative 'version.txt' also not found. Using default version '${DEFAULT_VERSION}'."
|
||||
!define VERSION "${DEFAULT_VERSION}"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!echo "Final VERSION defined as: '${VERSION}'"
|
||||
|
||||
; Application details
|
||||
!define APPNAME "Huntarr"
|
||||
!define EXENAME "Huntarr.exe"
|
||||
|
||||
Reference in New Issue
Block a user