diff --git a/.github/workflows/windows-build-nsis.yml b/.github/workflows/windows-build-nsis.yml index 2d29818c..792ada05 100644 --- a/.github/workflows/windows-build-nsis.yml +++ b/.github/workflows/windows-build-nsis.yml @@ -1,8 +1,14 @@ name: Windows Build with NSIS +# Add permissions needed for creating releases +permissions: + contents: write + on: push: branches: [ "main", "dev", "win-*" ] + tags: + - "*" # This will trigger on any tag push pull_request: branches: [ "main", "dev" ] workflow_dispatch: @@ -13,6 +19,20 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Extract metadata + id: meta + shell: bash + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + echo "IS_TAG=true" >> $GITHUB_OUTPUT + else + echo "VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT + echo "IS_TAG=false" >> $GITHUB_OUTPUT + fi - name: Set up Python uses: actions/setup-python@v4 @@ -76,11 +96,12 @@ jobs: & "C:\Program Files (x86)\NSIS\makensis.exe" $MakensisArgs # Check if installer was created - $installerPath = "distribution\windows\installer\installer\Huntarr_Setup.exe" + $version = (Get-Content version.txt).Trim() + $installerPath = "distribution\windows\installer\installer\Huntarr-${version}-win.exe" if (Test-Path $installerPath) { Write-Host "Installer created successfully at $installerPath" # Copy to expected upload location - Copy-Item -Path $installerPath -Destination "installer\Huntarr_Setup.exe" -Force + Copy-Item -Path $installerPath -Destination "installer\Huntarr-${version}-win.exe" -Force } else { Write-Error "Installer was not created. Check the logs above for errors." exit 1 @@ -93,4 +114,12 @@ jobs: uses: actions/upload-artifact@v4 with: name: huntarr-installer - path: installer/Huntarr_Setup.exe + path: installer/Huntarr-*-win.exe + + - name: Upload to release + if: steps.meta.outputs.IS_TAG == 'true' + uses: softprops/action-gh-release@v1 + with: + files: installer/Huntarr-*-win.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/distribution/windows/installer/huntarr_installer.nsi b/distribution/windows/installer/huntarr_installer.nsi index 1ddbc319..a6440e72 100644 --- a/distribution/windows/installer/huntarr_installer.nsi +++ b/distribution/windows/installer/huntarr_installer.nsi @@ -41,7 +41,8 @@ ; General settings Name "${APPNAME}" -OutFile "installer\${APPNAME}_Setup.exe" +!echo "Creating installer: Huntarr-${VERSION}-win.exe" +OutFile "installer\Huntarr-${VERSION}-win.exe" InstallDir "$PROGRAMFILES64\${APPNAME}" InstallDirRegKey HKLM "Software\${APPNAME}" "Install_Dir" RequestExecutionLevel admin ; Request admin privileges diff --git a/version.txt b/version.txt index c60ebc18..bf993904 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -7.0.5 \ No newline at end of file +7.0.7 \ No newline at end of file