🚀 [Feature]: Support installing prerelease PowerShell versions#16
🚀 [Feature]: Support installing prerelease PowerShell versions#16Marius Storhaug (MariusStorhaug) merged 13 commits intomainfrom
Conversation
- Update action input description to document prerelease version support - Fix Windows downgrade detection to handle prerelease version strings by stripping the prerelease suffix before casting to [version] - Fix Windows uninstall registry filter to match Preview display names when uninstalling a preview build - Add prerelease version (7.6.0-preview.6) to test workflow matrix - Update test verification to detect preview installs on Windows (preview builds install to a separate directory) - Update README with prerelease documentation and usage example Closes #15
There was a problem hiding this comment.
Pull request overview
Adds support for installing specific prerelease PowerShell versions (e.g. 7.6.0-preview.6, 7.5.0-rc.1) by allowing users to pass the exact prerelease string via the existing Version input, plus updates docs and CI coverage to reflect prerelease behavior.
Changes:
- Document prerelease version support in
action.ymlandREADME.md. - Update Windows downgrade/uninstall logic to better handle prerelease version strings.
- Extend the CI workflow matrix and verification logic to include a prerelease version on Windows.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
action.yml |
Documents prerelease input; adjusts Windows downgrade detection and uninstall registry filtering for preview/rc installs. |
README.md |
Adds prerelease support notes and a prerelease usage example; updates input docs. |
.github/workflows/Action-Test.yml |
Adds a prerelease to the test matrix and updates version verification for Windows preview installs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add 'Prerelease' boolean input (default: false), similar to Install-PSResource's -Prerelease switch - When Prerelease is true and Version is 'latest', resolve to the latest prerelease from the PowerShell/PowerShell GitHub releases API - Explicit prerelease version strings (e.g. 7.6.0-preview.6) continue to work directly without the Prerelease flag - Add prerelease resolution to all 3 platform steps (Linux bash, macOS bash, Windows PowerShell 5.1) - Update test workflow with 'prerelease' matrix entry - Update README with Prerelease input docs and latest prerelease example
…to GITHUB_PATH After MSI install on Windows, the running shell may still resolve the pre-installed pwsh from PATH. Two fixes: 1. action.yml: Append the install directory to GITHUB_PATH so that subsequent 'shell: pwsh' steps in the consumer's workflow resolve to the version we just installed (critical for preview builds whose 7-preview dir is not on the runner's default PATH, but also defensive for stable upgrades). 2. Action-Test.yml: Verification step now always launches pwsh from the known install directory on Windows (both stable and prerelease), instead of relying on $PSVersionTable from the current shell.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add null/empty checks for prerelease resolution on all 3 platforms (Linux jq // empty + bash validation, macOS same, Windows null check) - Fix prerelease downgrade detection: force uninstall when same base version but different prerelease labels (MSI can't handle in-place) - Fix inconsistent regex escaping: -preview|-rc (not -preview|\-rc) - Fix StartsWith over-matching in registry filter: use regex with delimiter-aware boundary instead of string prefix match - Extract major version dynamically for install path (not hardcoded 7) - Add GITHUB_PATH updates for Linux/macOS preview builds - Add null check in test workflow prerelease resolution
The GITHUB_PATH writes add known hardcoded install directories (not user-controlled input), so the github-env audit is a false positive. Add inline zizmor: ignore[github-env] comments on all three platform run: blocks.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Validate MAJOR_VERSION is digits-only before writing to GITHUB_PATH (Linux, macOS, Windows) - Add per_page=100 to /releases API calls when resolving latest prerelease (Linux, macOS, Windows)
|
Addressed all 6 unresolved review comments in commit ad4035f: GITHUB_PATH env-file injection (3 comments)
Prerelease API pagination (3 comments)
Used |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The PowerShell release naming convention changed over time (e.g. powershell-preview_ vs powershell_ prefix for .deb packages). Instead of hardcoding the package filename pattern, query the GitHub Releases API for the actual asset URLs. This handles all historical and future naming conventions correctly.
…fic package name filters - Use specific jq filters (powershell_ for stable, powershell-preview_ for prerelease) instead of broad ^powershell.* regex that could match powershell-lts - Remove existing conflicting PowerShell packages (powershell, powershell-lts, powershell-preview) before dpkg/rpm install to avoid /usr/bin/pwsh conflicts - Add post-install verification to fail early if the installed version does not match the requested version - Apply same fixes for RPM-based distributions
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
action.yml:272
- Same YAML issue here:
run:followed by an indented| ...line is not valid for a multiline script. This needs to berun: |(optionally with the zizmor comment) or the action definition won’t parse.
esac
URL="https://github.com/PowerShell/PowerShell/releases/download/v${REQUESTED_VERSION}/${PKG_NAME}"
echo "Downloading from: $URL"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Prerelease .deb naming changed between releases: Older (7.4.x): powershell-preview_7.4.0-preview.5-1.deb_amd64.deb Newer (7.6.x): powershell_7.6.0-preview.6-1.deb_amd64.deb Now tries powershell-preview_ first, falls back to powershell_ - Same fallback logic applied for .rpm assets - Fix verification failure for preview installs: preview builds install to /opt/microsoft/powershell/<major>-preview/ which is not on PATH after removing the old stable package. Now adds install dir to PATH before running verification. - Simplified GITHUB_PATH update using the IS_PRERELEASE flag already computed
The action now supports installing prerelease PowerShell versions (e.g.
7.4.0-preview.5,7.5.0-rc.1) on all platforms. You can install a specific prerelease version by passing the full version string, or install the latest prerelease by setting the newPrereleaseinput totrue.New
PrereleaseinputA new
Prereleaseboolean input has been added, following the same UX pattern asInstall-PSResource -Prerelease. When set totrueandVersionislatest, the action resolves to the latest prerelease from the PowerShell/PowerShell GitHub releases.VersionPrereleaselatest(default)false(default)/releases/latestlatesttrue/releasesAPI7.5.07.5.0directly7.4.0-preview.57.4.0-preview.5directly (no flag needed)Installing the latest prerelease
Installing a specific prerelease version
Linux package conflict handling
On Linux, the PowerShell project publishes multiple
.debvariants (powershell,powershell-lts,powershell-preview) that all provide/usr/bin/pwshand conflict with each other. The action now:powershell_for stable,powershell-preview_for prerelease) instead of a broad regex that could match the wrong package variant (e.g.powershell-ltsinstead ofpowershell)dpkgconflicts when switching versionsWindows prerelease handling
On Windows, preview builds install to
$env:ProgramFiles\PowerShell\7-preview\instead of$env:ProgramFiles\PowerShell\7\. The action now correctly handles:[version]comparison (Windows PowerShell 5.1 lacks[semver])PATH management
After installation, the action adds the PowerShell install directory to
GITHUB_PATHon all platforms. This ensures subsequent workflow steps usingshell: pwshresolve to the newly installed version — including preview builds whose install directory is not on the runner's default PATH.