* feat: Add Windows package manager publishing infrastructure (#343) - Add comprehensive release build scripts: - build-release.ps1: Creates portable ZIP + SHA256 checksums - build-exe.ps1: Standalone executable builder (PS2EXE) - build-msi.ps1: MSI installer builder (WiX Toolset) - Add GitHub Actions workflow: - Automated builds on version tags - Runs tests before building - Auto-creates GitHub releases with artifacts - Add package manager manifests: - WinGet: Complete manifests ready for microsoft/winget-pkgs - Chocolatey: Full package with install/uninstall scripts - Scoop: JSON manifest ready for submission - Add comprehensive documentation: - RELEASE.md: Complete guide for building and publishing - Package-specific READMEs with submission instructions - ISSUE-343-SUMMARY.md: Quick reference and next steps Successfully tested: Built mole-1.0.0-x64.zip (5 MB) with SHA256 checksums Addresses #343 * chore: update contributors [skip ci] * fix: Support uppercase V and -windows suffix in release workflow * fix: Remove duplicate parameter definitions in clean, optimize, and purge commands - bin/clean.ps1: Remove duplicate System, GameMedia, DebugMode, Whitelist params - bin/optimize.ps1: Remove duplicate DebugMode param - bin/purge.ps1: Remove duplicate DebugMode and Paths params These duplicates were causing parser errors in tests. * fix: Update test regex to match --dry-run format in help text The help output shows --dry-run (kebab-case) but test was checking for DryRun (PascalCase). Updated regex to accept both formats. * fix: Handle Pester 5.x result object properties correctly Pester 5.x uses different property names (Passed.Count, Failed.Count) instead of PassedCount, FailedCount. Added fallback logic to support both formats. * fix: Simplify Pester result parsing with better fallback logic Since Pester already prints test results, just check for failures and assume success if we can't parse the result object. This handles different Pester versions more gracefully. * feat: Add MSI and EXE builds to release workflow - Install WiX Toolset for MSI creation - Install PS2EXE module for standalone EXE - Build all three formats: ZIP, MSI, EXE - MSI and EXE builds marked optional (continue-on-error) - Upload all artifacts to GitHub release - Update release notes with installation instructions for all formats - Add SHA256 verification instructions for each format * fix: Resolve MSI and EXE build failures MSI build fix: - Use UTF8 without BOM for temp WXS file to avoid XML parsing errors - WiX compiler requires clean UTF8 encoding without byte order mark EXE build fix: - Remove hashtable iteration that modified collection during enumeration - Exclude null iconFile parameter from ps2exe params instead of removing it - Prevents 'Collection was modified' exception * fix: Properly handle encoding and version format for MSI and EXE builds MSI fix: - Use System.IO.File.ReadAllText/WriteAllText for consistent UTF8 without BOM - Prevents XML parsing errors in WiX compiler EXE fix: - Extract numeric version only (strip '-windows' suffix) for ps2exe - ps2exe requires version in format n.n.n.n (numeric only) - Fallback to 1.0.0.0 if version parsing fails * fix: Use WriteAllBytes to ensure no BOM in MSI WXS file - Convert string to UTF8 bytes manually - Write bytes directly to file - This guarantees no byte order mark is added - Prevents WiX XML parsing error at position 7 * fix: Read WXS source as bytes to completely avoid BOM issues - Read source file as raw bytes - Convert bytes to string using UTF8Encoding without BOM - Replace version in string - Convert back to bytes and write - This completely avoids PowerShell's Get-Content BOM handling * chore: Simplify release workflow - remove MSI build, minimal release notes - Remove MSI build steps (has persistent BOM/encoding issues) - Remove WiX Toolset installation - Simplify release notes to bare minimum - Focus on ZIP and EXE artifacts only --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
10 KiB
Mole Windows - Release Guide
This guide explains how to build and publish Mole for Windows package managers.
Prerequisites
Required Tools
-
PowerShell 5.1+
- Already included in Windows 10/11
- Verify:
$PSVersionTable.PSVersion
-
Go 1.21+
- Download: https://golang.org/dl/
- Verify:
go version
-
Git
- Download: https://git-scm.com/
- Verify:
git --version
Optional Tools (for specific build types)
-
WiX Toolset (for MSI installer)
choco install wixtoolset # Or download from: https://wixtoolset.org/ -
PS2EXE (for standalone EXE)
Install-Module ps2exe -Scope CurrentUser
Build Commands
Quick Start - Build Everything
# Build portable ZIP and checksums
.\scripts\build-release.ps1
# Optionally build MSI (requires WiX)
.\scripts\build-msi.ps1
# Optionally build standalone EXE (requires PS2EXE)
.\scripts\build-exe.ps1
Build Options
# Specify version explicitly
.\scripts\build-release.ps1 -Version "1.2.3"
# Skip running tests
.\scripts\build-release.ps1 -SkipTests
# Show help
.\scripts\build-release.ps1 -ShowHelp
Release Artifacts
After building, the release/ directory will contain:
release/
├── mole-1.0.0-x64.zip # Portable archive (required)
├── mole-1.0.0-x64.msi # MSI installer (optional)
├── mole-1.0.0-x64.exe # Standalone EXE (optional)
└── SHA256SUMS.txt # Checksums for verification
Publishing to Package Managers
1. WinGet (Highest Priority)
Requirements:
- GitHub release with ZIP or MSI
- SHA256 hash
- Fork of microsoft/winget-pkgs
Steps:
-
Create GitHub release:
# Tag the release git tag v1.0.0 git push origin v1.0.0 # Or use GitHub CLI gh release create v1.0.0 ` release/mole-1.0.0-x64.zip ` release/SHA256SUMS.txt ` --title "Mole v1.0.0" ` --notes "Release notes here" -
Install winget-create:
winget install Microsoft.WingetCreate -
Generate manifests:
# For new package wingetcreate new ` --token YOUR_GITHUB_TOKEN ` --urls https://github.com/bhadraagada/mole/releases/download/v1.0.0/mole-1.0.0-x64.zip # For updates wingetcreate update bhadraagada.mole ` --urls https://github.com/bhadraagada/mole/releases/download/v1.0.0/mole-1.0.0-x64.zip ` --version 1.0.0 ` --submit -
Manually submit (alternative):
# Fork microsoft/winget-pkgs git clone https://github.com/YOUR_USERNAME/winget-pkgs cd winget-pkgs # Create manifest directory mkdir -p manifests/b/bhadraagada/mole/1.0.0 # Copy template manifests (see templates/ below) # Then commit and create PR git add manifests/b/bhadraagada/mole/ git commit -m "New package: bhadraagada.mole version 1.0.0" git push # Create PR to microsoft/winget-pkgs
WinGet Manifest Template:
Create these files in manifests/b/bhadraagada/mole/1.0.0/:
bhadraagada.mole.yaml:
PackageIdentifier: bhadraagada.mole
PackageVersion: 1.0.0
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.4.0
bhadraagada.mole.locale.en-US.yaml:
PackageIdentifier: bhadraagada.mole
PackageVersion: 1.0.0
PackageLocale: en-US
Publisher: Mole Project
PublisherUrl: https://github.com/bhadraagada/mole
PublisherSupportUrl: https://github.com/bhadraagada/mole/issues
PackageName: Mole
PackageUrl: https://github.com/bhadraagada/mole
License: MIT
LicenseUrl: https://github.com/bhadraagada/mole/blob/windows/LICENSE
ShortDescription: Deep clean and optimize your Windows system
Description: |
All-in-one toolkit combining CCleaner, IObit Uninstaller, WinDirStat,
and Task Manager functionality for comprehensive Windows system
optimization and cleanup.
Moniker: mole
Tags:
- cleanup
- optimizer
- maintenance
- disk-space
- uninstaller
- system-tools
ManifestType: defaultLocale
ManifestVersion: 1.4.0
bhadraagada.mole.installer.yaml:
PackageIdentifier: bhadraagada.mole
PackageVersion: 1.0.0
InstallerLocale: en-US
MinimumOSVersion: 10.0.0.0
InstallerType: zip
NestedInstallerType: portable
NestedInstallerFiles:
- RelativeFilePath: mole.ps1
PortableCommandAlias: mole
Installers:
- Architecture: x64
InstallerUrl: https://github.com/bhadraagada/mole/releases/download/v1.0.0/mole-1.0.0-x64.zip
InstallerSha256: YOUR_SHA256_HERE
ManifestType: installer
ManifestVersion: 1.4.0
2. Chocolatey
Requirements:
- Chocolatey account
- .nuspec manifest
- PowerShell install/uninstall scripts
Steps:
-
Register at https://community.chocolatey.org/
-
Create package structure:
mkdir chocolatey cd chocolatey -
Create
mole.nuspec:<?xml version="1.0" encoding="utf-8"?> <package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> <metadata> <id>mole</id> <version>1.0.0</version> <title>Mole</title> <authors>Mole Project</authors> <owners>bhadraagada</owners> <licenseUrl>https://github.com/bhadraagada/mole/blob/windows/LICENSE</licenseUrl> <projectUrl>https://github.com/bhadraagada/mole</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Deep clean and optimize your Windows system. All-in-one toolkit for system maintenance.</description> <summary>Windows system cleanup and optimization tool</summary> <releaseNotes>https://github.com/bhadraagada/mole/releases</releaseNotes> <copyright>MIT License</copyright> <tags>cleanup optimization disk-space uninstaller maintenance</tags> <packageSourceUrl>https://github.com/bhadraagada/mole</packageSourceUrl> <docsUrl>https://github.com/bhadraagada/mole/blob/windows/README.md</docsUrl> <bugTrackerUrl>https://github.com/bhadraagada/mole/issues</bugTrackerUrl> </metadata> <files> <file src="tools\**" target="tools" /> </files> </package> -
Create
tools/chocolateyinstall.ps1:$ErrorActionPreference = 'Stop' $packageName = 'mole' $url64 = 'https://github.com/bhadraagada/mole/releases/download/v1.0.0/mole-1.0.0-x64.zip' $checksum64 = 'YOUR_SHA256_HERE' $checksumType = 'sha256' $toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition Install-ChocolateyZipPackage ` -PackageName $packageName ` -Url64bit $url64 ` -UnzipLocation $toolsDir ` -Checksum64 $checksum64 ` -ChecksumType64 $checksumType # Add to PATH $installDir = Join-Path $toolsDir "mole-1.0.0-x64" Install-ChocolateyPath -PathToInstall $installDir -PathType 'User' Write-Host "Mole has been installed successfully!" Write-Host "Run 'mole' to get started" -
Create
tools/chocolateyuninstall.ps1:$ErrorActionPreference = 'Stop' $toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition $installDir = Join-Path $toolsDir "mole-1.0.0-x64" # Remove from PATH Uninstall-ChocolateyPath -PathToUninstall $installDir -PathType 'User' Write-Host "Mole has been uninstalled" -
Build and push:
# Test locally first choco pack choco install mole -source . -y # Push to Chocolatey choco apikey --key YOUR_API_KEY --source https://push.chocolatey.org/ choco push mole.1.0.0.nupkg --source https://push.chocolatey.org/
3. Scoop (Easiest!)
Requirements:
- Fork of ScoopInstaller/Main
- Simple JSON manifest
Steps:
-
Create
bucket/mole.json:{ "version": "1.0.0", "description": "Deep clean and optimize your Windows system", "homepage": "https://github.com/bhadraagada/mole", "license": "MIT", "url": "https://github.com/bhadraagada/mole/releases/download/v1.0.0/mole-1.0.0-x64.zip", "hash": "sha256:YOUR_SHA256_HERE", "extract_dir": "mole-1.0.0-x64", "bin": "mole.ps1", "shortcuts": [ [ "mole.ps1", "Mole" ] ], "checkver": { "github": "https://github.com/bhadraagada/mole" }, "autoupdate": { "url": "https://github.com/bhadraagada/mole/releases/download/v$version/mole-$version-x64.zip" } } -
Submit PR:
git clone https://github.com/YOUR_USERNAME/Main scoop-main cd scoop-main # Add manifest copy path\to\mole.json bucket\ # Commit and push git add bucket/mole.json git commit -m "mole: Add version 1.0.0" git push # Create PR to ScoopInstaller/Main
Automated Releases (GitHub Actions)
The repository includes a GitHub Actions workflow for automated releases.
Trigger a release:
# Push a version tag
git tag v1.0.0
git push origin v1.0.0
# The workflow will automatically:
# 1. Run tests
# 2. Build release artifacts
# 3. Create GitHub release
# 4. Upload ZIP and checksums
Manual trigger:
Go to Actions → Build Windows Release → Run workflow
Testing Releases Locally
# Extract ZIP
Expand-Archive release/mole-1.0.0-x64.zip -DestinationPath test-install
# Test installation
cd test-install/mole-1.0.0-x64
.\install.ps1
# Verify mole works
mole --version
mole clean --dry-run
# Test MSI (if built)
msiexec /i release/mole-1.0.0-x64.msi /qn
Verification
Users can verify downloads using SHA256SUMS.txt:
# Download the release and checksums
$hash = (Get-FileHash mole-1.0.0-x64.zip).Hash
$expected = (Get-Content SHA256SUMS.txt | Select-String "mole-1.0.0-x64.zip").Line.Split()[0]
if ($hash -eq $expected) {
Write-Host "✓ Checksum verified!" -ForegroundColor Green
} else {
Write-Host "✗ Checksum mismatch!" -ForegroundColor Red
}
Troubleshooting
Build fails with "Go not found"
Install Go from https://golang.org/dl/ and restart PowerShell
WiX build fails
Ensure WiX Toolset is installed and in PATH:
choco install wixtoolset
Tests fail
Run tests manually to debug:
.\scripts\test.ps1
GitHub Actions workflow fails
Check the logs in the Actions tab. Common issues:
- Missing secrets (GITHUB_TOKEN is automatic)
- Wrong branch/tag format
- Test failures