How do I declare a script as prerelease in the powershellgallery?

213 Views Asked by At

I want to be able to update my script using update-script -allowprerelease. I'm not sure how to mark the script as prerelease before using Publish-Script to publish it. How do I do it?

I tried

$Params = @{
    PrivateData = @{
        PSData = @{
            PreRelease = 'Testing'
            }
        }
    }
Update-ScriptFileInfo @Params -PassThru

This added the following to the script, which didn't work:

.PRIVATEDATA System.Collections.Hashtable

1

There are 1 best solutions below

0
On

A module manifest declares its prerelease label under the PrivateData key, but a script manifest can simply declare it in the .VERSION metadata property:

<#PSScriptInfo
.VERSION 1.0.0-beta

.GUID 2c3b0ebf-4702-4d85-abc9-46053591a9d0

.AUTHOR Bobby Dore
#>

See Prerelease versions of scripts:

PowerShellGet support for prerelease versions is easier for scripts than modules. Script versioning is only supported by PowerShellGet, so there are no compatibility issues caused by adding the prerelease string. To identify a script in the PowerShell Gallery as a prerelease, add a prerelease suffix to a properly-formatted version string in the script metadata.

Edit:

Translated to a PowerShell command, the solution comes down to Update-ScriptFileInfo -Path "/path/to/script.ps1" -Version "1.0.0-beta".