diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 8808e29..92cf693 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -10,8 +10,8 @@ permissions: contents: write jobs: - build-zip: - runs-on: ubuntu-latest + build-packages: + runs-on: windows-latest outputs: version: ${{ steps.version.outputs.VERSION }} tag: ${{ steps.version.outputs.TAG }} @@ -22,32 +22,95 @@ jobs: - name: Generate version id: version + shell: pwsh run: | - date=$(date '+%y.%-m.%-d') - runNumber=${GITHUB_RUN_NUMBER:-0} - version="$date+$runNumber" - echo "VERSION=$version" >> $GITHUB_OUTPUT - echo "TAG=v$version" >> $GITHUB_OUTPUT + $date = Get-Date -Format "yy.M.d" + $runNumber = if ($env:GITHUB_RUN_NUMBER) { $env:GITHUB_RUN_NUMBER } else { "0" } + $version = "$date+$runNumber" + echo "VERSION=$version" >> $env:GITHUB_OUTPUT + echo "TAG=v$version" >> $env:GITHUB_OUTPUT echo "Generated version: $version" - name: Inject version run: | - echo "${{ steps.version.outputs.VERSION }}" > version.txt - + echo "${{ steps.version.outputs.VERSION }}" | Out-File -FilePath version.txt -NoNewline -Encoding utf8 + + - name: Prepare staging directory + run: | + # Create staging directory + New-Item -Path "staging" -ItemType Directory -Force | Out-Null - - name: Package archive + # Copy only files listed in manifest.txt to staging directory + Get-Content manifest.txt | Where-Object { $_.Trim() -and -not $_.StartsWith('#') } | ForEach-Object { + $file = $_.Trim() + $source = Join-Path "." $file + $dest = Join-Path "staging" $file + + if (Test-Path $source) { + # Create destination directory if needed + $destDir = Split-Path $dest -Parent + if ($destDir -and -not (Test-Path $destDir)) { + New-Item -Path $destDir -ItemType Directory -Force | Out-Null + } + Copy-Item -Path $source -Destination $dest -Force + Write-Host "✓ Staged: $file" + } else { + Write-Warning "File not found: $file" + } + } + + Write-Host "`nStaging directory prepared with manifest files" + + - name: Package ZIP archive run: | - cat manifest.txt | xargs zip "skHost-${{ steps.version.outputs.VERSION }}.zip" - - - name: Upload ZIP artifact + $version = "${{ steps.version.outputs.VERSION }}" + Compress-Archive -Path "staging\*" -DestinationPath "skHost-$version.zip" -Force + Write-Host "Created ZIP: skHost-$version.zip" + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Install WiX Toolset + run: | + dotnet tool install --global wix --version 4.0.5 + wix --version + + - name: Build MSI + working-directory: wix + run: | + # Convert version format from YY.M.D+RUN to YY.M.D.RUN for MSI + $version = "${{ steps.version.outputs.VERSION }}" + $msiVersion = $version -replace '\+', '.' + Write-Host "Building MSI with version: $msiVersion" + + dotnet build -c Release -p:Version=$msiVersion + + - name: Rename MSI with version + run: | + $version = "${{ steps.version.outputs.VERSION }}" + $msiFile = Get-ChildItem -Path "wix\bin\Release" -Filter "*.msi" -Recurse | Select-Object -First 1 + if ($msiFile) { + $newName = "skHost-$version.msi" + Move-Item -Path $msiFile.FullName -Destination $newName -Force + Write-Host "Renamed MSI to: $newName" + } else { + Write-Error "MSI file not found" + exit 1 + } + + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: skhost-zip - path: skHost-${{ steps.version.outputs.VERSION }}.zip + name: skhost-packages + path: | + skHost-${{ steps.version.outputs.VERSION }}.zip + skHost-${{ steps.version.outputs.VERSION }}.msi retention-days: 1 create-release: - needs: build-zip + needs: build-packages runs-on: ubuntu-latest steps: @@ -59,16 +122,29 @@ jobs: - name: Create GitHub release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ needs.build-zip.outputs.tag }} - name: "skHost ${{ needs.build-zip.outputs.version }}" + tag_name: ${{ needs.build-packages.outputs.tag }} + name: "skHost ${{ needs.build-packages.outputs.version }}" body: | *Automated release built from commit ${{ github.sha }}* ## Downloads: - - `skHost-${{ needs.build-zip.outputs.version }}.zip` - Main application package. + - `skHost-${{ needs.build-packages.outputs.version }}.zip` - Portable ZIP archive with PowerShell installation script + - `skHost-${{ needs.build-packages.outputs.version }}.msi` - Windows Installer package ## Installation: - See README.md for installation and usage instructions. + + **MSI Installer (Recommended for personal systems):** + Download and run the `.msi` file. The installer provides: + - Automatic installation to `%LocalAppData%\SaltSpectre\skHost` + - Optional PATH registration for command-line access + - Optional auto-start at Windows logon + - Start Menu shortcuts + - Easy uninstallation via Windows Settings + + **ZIP Archive (Portable usage or PowerShell based installation):** + Extract the ZIP and run `skhost.ps1 -Install` or `skhost.ps1 -AutoStart` for manual installation. + + See README.md for detailed usage instructions. files: artifacts/**/* prerelease: false diff --git a/app_handler.ps1 b/app_handler.ps1 index 78c1ff1..b8fa55e 100644 --- a/app_handler.ps1 +++ b/app_handler.ps1 @@ -68,9 +68,11 @@ Function Install-skHost { if ($AutoStart) { if (Test-RegistryValue "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" "skHost") { Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "skHost" -Force -Confirm:$false + Write-skSessionLog -Message "ℹ️ Removed existing autostart registry entry for skHost." -Type "INFO" -Color Cyan } # Specify to use conhost in case Windows Terminal is set as default as it does not support WindowStyle Hidden like conhost - New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "skHost" -PropertyType String -Value "conhost powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$InstallPath\skhost.ps1`"" -Force -Confirm:$false + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "skHost" -PropertyType String -Value "conhost powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$InstallPath\skhost.ps1`"" -Force -Confirm:$false | Out-Null + Write-skSessionLog -Message "✔️ Created autostart registry entry for skHost." -Type "SUCCESS" -Color Green } # Create Start Menu Shortcut @@ -88,6 +90,7 @@ Function Install-skHost { $Shortcut.IconLocation = "$env:SystemRoot\system32\shell32.dll,43" } $Shortcut.Save() + Write-skSessionLog -Message "✔️ Created Start Menu shortcut for skHost." -Type "SUCCESS" -Color Green } Function Uninstall-skHost { @@ -95,18 +98,23 @@ Function Uninstall-skHost { $NewInstallPath = "$env:LOCALAPPDATA\SaltSpectre\ps-skhost" if (Test-Path $NewInstallPath) { Remove-Item -Path $NewInstallPath -Recurse -Force -Confirm:$false -ErrorAction SilentlyContinue - Write-skSessionLog -Message "Removed: $NewInstallPath" -Type "SUCCESS" -Color Green + Write-skSessionLog -Message "✔️ Removed: $NewInstallPath" -Type "SUCCESS" -Color Green } # Clean up old installation files (backward compatibility) Remove-Item -Path "$env:LOCALAPPDATA\skHost.ps1" -Force -Confirm:$false -ErrorAction SilentlyContinue + Write-skSessionLog -Message "✔️ Removed old installation file: $env:LOCALAPPDATA\skHost.ps1" -Type "SUCCESS" -Color Green foreach ($format in @('ico', 'png', 'bmp')) { Remove-Item -Path "$env:LOCALAPPDATA\skHost.$format" -Force -Confirm:$false -ErrorAction SilentlyContinue + Write-skSessionLog -Message "✔️ Removed old installation icon file: $env:LOCALAPPDATA\skHost.$format" -Type "SUCCESS" -Color Green } # Remove shared components Remove-Item -Path "$env:APPDATA\Microsoft\Windows\Start Menu\skHost.lnk" -Force -Confirm:$false -ErrorAction SilentlyContinue + Write-skSessionLog -Message "✔️ Removed Start Menu shortcut: $env:APPDATA\Microsoft\Windows\Start Menu\skHost.lnk" -Type "SUCCESS" -Color Green Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "skHost" -Force -Confirm:$false -ErrorAction SilentlyContinue + Write-skSessionLog -Message "✔️ Removed autostart registry entry for skHost." -Type "SUCCESS" -Color Green - Write-skSessionLog -Message "Uninstall completed." -Type "SUCCESS" -Color Green + Write-skSessionLog -Message "✔️ Uninstall completed." -Type "SUCCESS" -Color Green + Remove-Item $SESSION_LOG -Force -Confirm:$false -ErrorAction SilentlyContinue } diff --git a/manifest.txt b/manifest.txt index 1db0aa7..36849dc 100644 --- a/manifest.txt +++ b/manifest.txt @@ -7,4 +7,6 @@ manifest.txt version.txt log.ps1 app_handler.ps1 -icon_handler.ps1 \ No newline at end of file +icon_handler.ps1 +LICENSE +README.md \ No newline at end of file diff --git a/version.txt b/version.txt index 32bae0a..7617c62 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -dev-sksink \ No newline at end of file +dev-wix \ No newline at end of file diff --git a/wix/License.rtf b/wix/License.rtf new file mode 100644 index 0000000..1e1afff --- /dev/null +++ b/wix/License.rtf @@ -0,0 +1,12 @@ +{\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fswiss\fcharset0 Arial;}} +{\*\generator Riched20 10.0.19041}\viewkind4\uc1 +\pard\b\f0\fs24 MIT License\b0\fs20\par +\par +Copyright (c) 2026 SaltSpectre\par +\par +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par +\par +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\par +\par +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\par +} diff --git a/wix/Product.wxs b/wix/Product.wxs new file mode 100644 index 0000000..9497f83 --- /dev/null +++ b/wix/Product.wxs @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wix/skHost.wixproj b/wix/skHost.wixproj new file mode 100644 index 0000000..4fc1557 --- /dev/null +++ b/wix/skHost.wixproj @@ -0,0 +1,28 @@ + + + skHost + ICE38;ICE64;ICE91 + 1.0.0.0 + Version=$(Version) + + + + ..\staging + true + + + + + PublishedFiles + INSTALLFOLDER + true + + + + + + + + + +