Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 96 additions & 20 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -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
Expand Down
14 changes: 11 additions & 3 deletions app_handler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -88,25 +90,31 @@ 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 {
# Remove new installation directory structure
$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
}
4 changes: 3 additions & 1 deletion manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ manifest.txt
version.txt
log.ps1
app_handler.ps1
icon_handler.ps1
icon_handler.ps1
LICENSE
README.md
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dev-sksink
dev-wix
12 changes: 12 additions & 0 deletions wix/License.rtf
Original file line number Diff line number Diff line change
@@ -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
}
131 changes: 131 additions & 0 deletions wix/Product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">

<Package Name="skHost"
Language="1033"
Version="$(Version)"
Manufacturer="SaltSpectre"
UpgradeCode="89430433-beba-43a1-97a0-2689bcb98431"
InstallerVersion="500"
Compressed="yes"
Scope="perUser">

<SummaryInformation Description="An idle prevention tool for local, RDP, RemoteApp, and Hyper-V sessions written entirely in PowerShell for maximum portability." />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

<MediaTemplate EmbedCab="yes" />

<Feature Id="ProductFeature"
Title="skHost"
Level="1"
Display="expand"
ConfigurableDirectory="INSTALLFOLDER"
AllowAbsent="no"
AllowAdvertise="no"
Description="The main skHost application (required).">
<ComponentGroupRef Id="PublishedFiles" />
<ComponentRef Id="ApplicationShortcutComponent" />

<Feature Id="PathFeature"
Title="PATH Registration"
Level="1"
AllowAdvertise="no"
Description="Adds skHost to your PATH environment variable for easy command-line access.">
<ComponentRef Id="PathEnvironmentComponent" />
</Feature>

<Feature Id="AutoStartFeature"
Title="Auto start at logon"
Level="1"
AllowAdvertise="no"
Description="Automatically starts skHost when you log in to Windows.">
<ComponentRef Id="AutoStartComponent" />
</Feature>
</Feature>

<Icon Id="ProductIcon" SourceFile="../skHost.ico" />
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
<Property Id="ARPHELPLINK" Value="https://github.com/SaltSpectre/skHost" />

<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<ui:WixUI Id="WixUI_FeatureTree" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

<StandardDirectory Id="LocalAppDataFolder">
<Directory Id="ManufacturerFolder" Name="SaltSpectre">
<Directory Id="INSTALLFOLDER" Name="skHost" />
</Directory>
</StandardDirectory>

<StandardDirectory Id="ProgramMenuFolder">
<Directory Id="ManufacturerProgramsFolder" Name="SaltSpectre">
<Directory Id="ApplicationProgramsFolder" Name="skHost" />
</Directory>
</StandardDirectory>

</Package>

<Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcutComponent" Guid="B3A4C8D1-2E5F-4A6B-9C7D-8E1F2A3B4C5D">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="skHost"
Description="An idle prevention tool for local, RDP, RemoteApp, and Hyper-V sessions written entirely in PowerShell for maximum portability."
Target="[System64Folder]conhost.exe"
Arguments="powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File &quot;[INSTALLFOLDER]skhost.ps1&quot;"
WorkingDirectory="INSTALLFOLDER"
Icon="ProductIcon" />
<Shortcut Id="UninstallProduct"
Name="Uninstall skHost"
Description="Uninstalls skHost"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />
<RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall" />
<RemoveFolder Id="CleanUpManufacturerPrograms" Directory="ManufacturerProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU"
Key="Software\SaltSpectre\skHost"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>

<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="PathEnvironmentComponent" Guid="C5D6E7F8-9A0B-1C2D-3E4F-5A6B7C8D9E0F">
<Environment Id="PathEnvironment"
Name="PATH"
Value="[INSTALLFOLDER]"
Permanent="no"
Part="last"
Action="set"
System="no" />
<CreateFolder />
<RegistryValue Root="HKCU"
Key="Software\SaltSpectre\skHost"
Name="PathSet"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>

<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="AutoStartComponent" Guid="D6E7F8A9-0B1C-2D3E-4F5A-6B7C8D9E0F1A">
<RegistryValue Root="HKCU"
Key="Software\Microsoft\Windows\CurrentVersion\Run"
Name="skHost"
Type="string"
Value="conhost powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File &quot;[INSTALLFOLDER]skhost.ps1&quot;"
KeyPath="yes" />
</Component>
</DirectoryRef>
</Fragment>

</Wix>
28 changes: 28 additions & 0 deletions wix/skHost.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="WixToolset.Sdk/4.0.5">
<PropertyGroup>
<OutputName>skHost</OutputName>
<SuppressIces>ICE38;ICE64;ICE91</SuppressIces>
<Version Condition="'$(Version)' == ''">1.0.0.0</Version>
<DefineConstants>Version=$(Version)</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<PublishDir>..\staging</PublishDir>
<HarvestDirectorySuppressRootDirectory>true</HarvestDirectorySuppressRootDirectory>
</PropertyGroup>

<ItemGroup>
<HarvestDirectory Include="$(PublishDir)">
<ComponentGroupName>PublishedFiles</ComponentGroupName>
<DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
<SuppressRootDirectory>true</SuppressRootDirectory>
</HarvestDirectory>
<BindPath Include="$(PublishDir)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="WixToolset.Heat" Version="4.0.5" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.5" />
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.5" />
</ItemGroup>
</Project>