Skip to content

Commit 6c3a43a

Browse files
committed
Change name to PSGALLERY_API_KEY
semver:breaking
1 parent 8b3fe54 commit 6c3a43a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Build.build.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ if ($dotnetProjects) {
6464
}
6565
} else {
6666
if ($Clean) {
67-
Add-BuildTask . Clean, GitVersion, PSModuleRestore, PSModuleBuild, PSModuleTest, PSModulePublish
67+
Add-BuildTask . Clean, GitVersion, PSModuleRestore, PSModuleBuild, PSModuleTest, PSModulePush
6868
} else {
69-
Add-BuildTask . GitVersion, PSModuleRestore, PSModuleBuild, PSModuleTest, PSModulePublish
69+
Add-BuildTask . GitVersion, PSModuleRestore, PSModuleBuild, PSModuleTest, PSModulePush
7070
}
7171
}
7272

PSModulePush.Task.ps1

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Add-BuildTask PSModulePush {
22
if ($BuildSystem -ne 'None' -and
33
$BranchName -in "master","main" -and
4-
-not [string]::IsNullOrWhiteSpace($PSModulePublishKey)) {
4+
-not [string]::IsNullOrWhiteSpace($PSGalleryKey)) {
55

6-
# If the $PSModulePublishUri is set, make sure that's where we publish....
7-
if ($PSModulePublishUri -and $Script:PSRepository) {
6+
# If the $PSGalleryUri is set, make sure that's where we publish....
7+
if ($PSGalleryUri -and $Script:PSRepository) {
88
$PackageSource = Get-PSRepository -Name $Script:PSRepository -ErrorAction Ignore
9-
If (-Not $PackageSource -or $PackageSource.PublishLocation -ne $PSModulePublishUri) {
9+
If (-Not $PackageSource -or $PackageSource.PublishLocation -ne $PSGalleryUri) {
1010
$source = @{
1111
Name = $Script:PSRepository
12-
Location = $PSModulePublishUri
12+
Location = $PSGalleryUri
1313
Force = $true
1414
Trusted = $True
1515
ForceBootstrap = $True
@@ -20,7 +20,7 @@ Add-BuildTask PSModulePush {
2020
}
2121
$publishModuleSplat = @{
2222
Path = $PSModuleOutputPath
23-
NuGetApiKey = $PSModulePublishKey
23+
NuGetApiKey = $PSGalleryKey
2424
Verbose = $true
2525
Force = $true
2626
Repository = $Script:PSRepository
@@ -37,7 +37,7 @@ Add-BuildTask PSModulePush {
3737
Write-Warning ("Skipping publish: To publish, ensure that...`n" +
3838
"`t* You are in a known build system (Current: $BuildSystem)`n" +
3939
"`t* You are committing to the main branch (Current: $BranchName) `n" +
40-
"`t* The repository APIKey is defined in `$PSModulePublishKey (Current: $(![string]::IsNullOrWhiteSpace($PSModulePublishKey)))")
40+
"`t* The repository APIKey is defined in `$PSGalleryKey (Current: $(![string]::IsNullOrWhiteSpace($PSGalleryKey)))")
4141
}
4242
}
43-
Add-BuildTask PSModulePublish PSModulePush
43+
Add-BuildTask PSGallery PSModulePush

_Initialize.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ if ($PSModuleName) {
242242
Write-Information " PSRepository: $PSRepository"
243243

244244
# In order to publish modules, you may need to set these before running the build
245-
$script:PSModulePublishUri ??= $Env:PSMODULE_PUBLISH_URI ?? "https://www.powershellgallery.com/api/v2"
246-
$script:PSModulePublishKey ??= $Env:PSMODULE_PUBLISH_KEY
247-
Write-Information " PSModulePublishUri: $PSModulePublishUri"
245+
$script:PSGalleryUri ??= $Env:PSGALLERY_URI ?? "https://www.powershellgallery.com/api/v2"
246+
$script:PSGalleryKey ??= $Env:PSGALLERY_API_KEY
247+
Write-Information " PSGalleryUri: $PSGalleryUri"
248248
}
249249
#endregion
250250

0 commit comments

Comments
 (0)