Commit fae8569
authored
🚀 [Feature]: Support installing prerelease PowerShell versions (#16)
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 new `Prerelease` input to
`true`.
- Fixes #15
## New `Prerelease` input
A new `Prerelease` boolean input has been added, following the same UX
pattern as `Install-PSResource -Prerelease`. When set to `true` and
`Version` is `latest`, the action resolves to the latest prerelease from
the PowerShell/PowerShell GitHub releases.
| Usage | `Version` | `Prerelease` | Result |
|-------|-----------|-------------|--------|
| Latest stable | `latest` (default) | `false` (default) | Resolves to
latest stable via `/releases/latest` |
| Latest prerelease | `latest` | `true` | Resolves to latest prerelease
via `/releases` API |
| Specific stable | `7.5.0` | — | Installs `7.5.0` directly |
| Specific prerelease | `7.4.0-preview.5` | — | Installs
`7.4.0-preview.5` directly (no flag needed) |
### Installing the latest prerelease
```yaml
- uses: PSModule/Install-PowerShell@v1
with:
Prerelease: true
```
### Installing a specific prerelease version
```yaml
- uses: PSModule/Install-PowerShell@v1
with:
Version: 7.4.0-preview.5
```
## Linux package conflict handling
On Linux, the PowerShell project publishes multiple `.deb` variants
(`powershell`, `powershell-lts`, `powershell-preview`) that all provide
`/usr/bin/pwsh` and conflict with each other. The action now:
- Uses specific asset name filters (`powershell_` for stable,
`powershell-preview_` for prerelease) instead of a broad regex that
could match the wrong package variant (e.g. `powershell-lts` instead of
`powershell`)
- Removes all existing PowerShell packages before installing to avoid
`dpkg` conflicts when switching versions
- Verifies the installed version matches the requested version after
install, failing early with a clear error if not
- Applies the same fixes for RPM-based distributions
## Windows prerelease handling
On Windows, preview builds install to
`$env:ProgramFiles\PowerShell\7-preview\` instead of
`$env:ProgramFiles\PowerShell\7\`. The action now correctly handles:
- Downgrade detection by stripping the prerelease suffix before
`[version]` comparison (Windows PowerShell 5.1 lacks `[semver]`)
- Uninstall registry filtering to match Preview display names when the
current version is a preview
- Cross-prerelease version changes (same base version, different label)
by forcing an uninstall-then-install cycle
## PATH management
After installation, the action adds the PowerShell install directory to
`GITHUB_PATH` on all platforms. This ensures subsequent workflow steps
using `shell: pwsh` resolve to the newly installed version — including
preview builds whose install directory is not on the runner's default
PATH.1 parent d8fbe1f commit fae8569
3 files changed
+306
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
47 | 63 | | |
48 | | - | |
| 64 | + | |
49 | 65 | | |
50 | 66 | | |
51 | 67 | | |
| |||
59 | 75 | | |
60 | 76 | | |
61 | 77 | | |
62 | | - | |
63 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
64 | 96 | | |
65 | 97 | | |
66 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
28 | 47 | | |
29 | 48 | | |
30 | 49 | | |
31 | 50 | | |
32 | | - | |
| 51 | + | |
| 52 | + | |
33 | 53 | | |
34 | 54 | | |
35 | 55 | | |
| |||
43 | 63 | | |
44 | 64 | | |
45 | 65 | | |
46 | | - | |
| 66 | + | |
| 67 | + | |
47 | 68 | | |
48 | 69 | | |
49 | 70 | | |
| |||
0 commit comments