11name : Windows Build with NSIS
22
3+ # Add permissions needed for creating releases
4+ permissions :
5+ contents : write
6+
37on :
48 push :
59 branches : [ "main", "dev", "win-*" ]
10+ tags :
11+ - " *" # This will trigger on any tag push
612 pull_request :
713 branches : [ "main", "dev" ]
814 workflow_dispatch :
1319
1420 steps :
1521 - uses : actions/checkout@v3
22+ with :
23+ fetch-depth : 0
24+
25+ - name : Extract metadata
26+ id : meta
27+ shell : bash
28+ run : |
29+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
30+ echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
31+ echo "IS_TAG=true" >> $GITHUB_OUTPUT
32+ else
33+ echo "VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT
34+ echo "IS_TAG=false" >> $GITHUB_OUTPUT
35+ fi
1636
1737 - name : Set up Python
1838 uses : actions/setup-python@v4
@@ -76,11 +96,12 @@ jobs:
7696 & "C:\Program Files (x86)\NSIS\makensis.exe" $MakensisArgs
7797
7898 # Check if installer was created
79- $installerPath = "distribution\windows\installer\installer\Huntarr_Setup.exe"
99+ $version = (Get-Content version.txt).Trim()
100+ $installerPath = "distribution\windows\installer\installer\Huntarr-${version}-win.exe"
80101 if (Test-Path $installerPath) {
81102 Write-Host "Installer created successfully at $installerPath"
82103 # Copy to expected upload location
83- Copy-Item -Path $installerPath -Destination "installer\Huntarr_Setup .exe" -Force
104+ Copy-Item -Path $installerPath -Destination "installer\Huntarr-${version}-win .exe" -Force
84105 } else {
85106 Write-Error "Installer was not created. Check the logs above for errors."
86107 exit 1
@@ -93,4 +114,12 @@ jobs:
93114 uses : actions/upload-artifact@v4
94115 with :
95116 name : huntarr-installer
96- path : installer/Huntarr_Setup.exe
117+ path : installer/Huntarr-*-win.exe
118+
119+ - name : Upload to release
120+ if : steps.meta.outputs.IS_TAG == 'true'
121+ uses : softprops/action-gh-release@v1
122+ with :
123+ files : installer/Huntarr-*-win.exe
124+ env :
125+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments