1212 modules to be published (i.e. .\AWSPowerShell, .\AWSPowerShell.NetCore, and
1313 .\AWS.Tools).
1414
15- Publishing is done using the Publish-Module cmdlet of the PowerShellGet
15+ Publishing is done using the Publish-PSResource cmdlet of the PSResourceGet
1616 module. This module must be installed either in user scope or globally
1717 before this script can be used.
1818
@@ -87,7 +87,7 @@ $ErrorActionPreference = "Stop"
8787$paramSetRemoteName = " remote"
8888$paramSetLocalName = " local"
8989
90- Import-Module - Name " PowerShellGet "
90+ Import-Module Microsoft.PowerShell.PSResourceGet
9191
9292# Import DynamoDBv2 needed to update the PackageVersions table.
9393if ($PSCmdlet.ParameterSetName -eq $paramSetRemoteName ) {
@@ -101,7 +101,7 @@ if ($PSCmdlet.ParameterSetName -eq $paramSetRemoteName) {
101101}
102102elseif ($PSCmdlet.ParameterSetName -eq $paramSetLocalName ){
103103 # validate if the LocalRepositoryName exists
104- $localRepo = Get-PSRepository - Name $LocalRepositoryName - ErrorAction SilentlyContinue
104+ $localRepo = Get-PSResourceRepository - Name $LocalRepositoryName - ErrorAction SilentlyContinue
105105 if (-not $localRepo ){
106106 throw " Local repository $LocalRepositoryName does not exist."
107107 }
@@ -127,13 +127,13 @@ if (-not $DryRun -and $PSCmdlet.ParameterSetName -eq $paramSetRemoteName) {
127127
128128if ($PSCmdlet.ParameterSetName -eq $paramSetRemoteName ) {
129129 $commonArgs = @ {
130- ' NuGetApiKey ' = $ApiKey
130+ ' ApiKey ' = $ApiKey
131131 ' Repository' = " PSGallery"
132132 }
133133}
134134else {
135135 $commonArgs = @ {
136- ' NuGetApiKey ' = $LocalRepositoryNuGetApiKey
136+ ' ApiKey ' = $LocalRepositoryNuGetApiKey
137137 ' Repository' = $LocalRepositoryName
138138 }
139139}
@@ -170,7 +170,7 @@ function PublishRecursive([string]$modulePath) {
170170 Write-Host " -DryRun specified, skipped actual publish and PackageVersions update of $modulePath "
171171 }
172172 else {
173- Publish-Module - Path $modulePath @commonArgs - Force
173+ Publish-PSResource - Path $modulePath @commonArgs
174174 if ($PSCmdlet.ParameterSetName -eq $paramSetRemoteName ) {
175175 Update-ModulePackageVersion - modulePath $modulePath - versionNumber $manifestData.ModuleVersion - repository " PSGallery" - profileName $UpdatePackageVersionsProfile
176176 }
@@ -182,7 +182,7 @@ function PublishRecursive([string]$modulePath) {
182182 # We could have failed because the module was already published (possible in case we run this script multiple times)
183183 if ($PSCmdlet.ParameterSetName -eq $paramSetRemoteName ) {
184184 try {
185- Find-Module ([System.IO.Path ]::GetFileNameWithoutExtension($manifest )) - RequiredVersion $manifestData.ModuleVersion
185+ Find-PSResource - Repository ' PSGallery ' - Type ' Module' - Name ([System.IO.Path ]::GetFileNameWithoutExtension($manifest )) - Version $manifestData.ModuleVersion
186186 Write-Host " Successfully found module $modulePath version $ ( $manifestData.ModuleVersion ) already on the gallery"
187187 if ($DryRun ) {
188188 Write-Host " -DryRun specified, skipped PackageVersions update of $modulePath in catch."
0 commit comments