@@ -64,8 +64,8 @@ foreach ($item in $moduleFolders){
64
64
}
65
65
66
66
if ($testModuleFailed ) {}
67
- elseif ($moduleStatus -ne " " ) {-and ! $testModuleFailed
68
- Write-Warning " $ ( $moduleName ) : $moduleStatus " testModuleFailed
67
+ elseif ($moduleStatus -ne " " ) {
68
+ Write-Warning " $ ( $moduleName ) : $moduleStatus "
69
69
}
70
70
else {
71
71
$modulesToPublish += $item
@@ -77,13 +77,14 @@ if ($modulesToPublish.Count -gt 0){
77
77
78
78
Import-Module (Join-Path $PSScriptRoot / Modules/ IntelliTect.CredentialManager)
79
79
$credential = Get-CredentialManagerCredential " pstoolbox" - ErrorAction SilentlyContinue
80
-
81
- if (! $PowerShellGalleryAPIKey ) {
82
- $PowerShellGalleryAPIKey = ([PSCredential ]$credential ).GetNetworkCredential().Password
80
+
81
+ if (! $PowerShellGalleryAPIKey -and $credential ) {
82
+ $PowerShellGalleryAPIKey = ([PSCredential ]$credential ).GetNetworkCredential().Password
83
83
}
84
84
85
85
if (! $PowerShellGalleryAPIKey ) {
86
- $PowerShellGalleryAPIKey = Read-Host " Enter your PS Gallery API Key"
86
+ $PowerShellGalleryAPIKey = Read-Host " Enter your PS Gallery API Key" - AsSecureString
87
+ $EncryptedInput = ConvertFrom-SecureString - String $PowerShellGalleryAPIKey
87
88
}
88
89
89
90
if (! $PowerShellGalleryAPIKey ) {
@@ -92,12 +93,12 @@ if ($modulesToPublish.Count -gt 0){
92
93
93
94
if ($SaveAPIKey ) {
94
95
if ($PowerShellGalleryAPIKey -and $SaveAPIKey ) {
95
- $cred = New-Object System.Management.Automation.PSCredential " intellitect" , ($PowerShellGalleryAPIKey | ConvertTo-SecureString - AsPlainText - Force )
96
+ $cred = New-Object System.Management.Automation.PSCredential " intellitect" , ($PowerShellGalleryAPIKey | ConvertTo-SecureString - String $EncryptedInput )
96
97
Set-CredentialManagerCredential - TargetName " pstoolbox" - Credential $cred
97
98
}
98
99
}
99
-
100
- foreach ($item in $modulesToPublish ) {
100
+
101
+ foreach ($item in $modulesToPublish ) {
101
102
Publish-Module - Path $item.FullName - NuGetApiKey $PowerShellGalleryAPIKey
102
103
}
103
104
Write-Progress - Activity " Publish IntelliTect Module" - Completed
0 commit comments