Bobby Dore
Bobby Dore

Reputation: 893

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

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

Upvotes: 3

Views: 273

Answers (1)

Michiel van Oosterhout
Michiel van Oosterhout

Reputation: 23094

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".

Upvotes: 0

Related Questions