Skip to content

Commit f2d9290

Browse files
authored
🚀 Publish External Help with module (#319)
* 🚀 Update CI Publish built module properly * 🚀 Update deployment targets * 🚀 fail CI on publish if XML is missing
1 parent 3863588 commit f2d9290

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

Build/Psake.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ $Lines
9090
# Bump the module version if we didn't already
9191
try {
9292
$GalleryVersion = Get-NextNugetPackageVersion -Name $env:BHProjectName -ErrorAction Stop
93-
$GithubVersion = Get-MetaData -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -ErrorAction Stop
93+
$GithubVersion = Get-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -ErrorAction Stop
9494
if ($GalleryVersion -ge $GithubVersion) {
9595
Update-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -Value $GalleryVersion -ErrorAction stop
9696
}
@@ -104,4 +104,9 @@ Continuing with existing version.
104104

105105
# Build external help files from Platyps MD files
106106
New-ExternalHelp -Path "$ProjectRoot/docs/" -OutputPath "$ProjectRoot/PSKoans/en-us"
107+
108+
$BuiltModuleFolder = "$ProjectRoot/BuiltModule/"
109+
Write-Host "##vso[task.setvariable variable=BuiltModuleFolder]$BuiltModuleFolder"
110+
New-Item -Path $BuiltModuleFolder -ItemType Directory
111+
Copy-Item -Path "$ProjectRoot/PSKoans" -Destination $BuiltModuleFolder -Recurse -PassThru
107112
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Deploy Module {
22
By PSGalleryModule {
3-
FromSource PSKoans
3+
FromSource "$PSScriptRoot/PSKoans"
44
To FileSystem
55
WithOptions @{
6-
ApiKey = $ENV:NugetApiKey
6+
ApiKey = 'FileSystem'
77
}
88
}
99
}

Deploy/PSGallery/PSKoans.psdeploy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Deploy Module {
22
By PSGalleryModule {
3-
FromSource PSKoans
3+
FromSource "$PSScriptRoot/PSKoans"
44
To PSGallery
55
WithOptions @{
66
ApiKey = $ENV:NugetApiKey

Deploy/Publish.ps1

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ param(
1010
$OutputDirectory
1111
)
1212

13-
$ENV:NugetApiKey = $Key
13+
$env:NugetApiKey = $Key
1414

1515
if ($OutputDirectory) {
1616
$Params = @{
@@ -33,6 +33,21 @@ if ($OutputDirectory) {
3333
}
3434
}
3535

36+
$HelpFile = Get-ChildItem -Path $Path -File -Recurse -Filter '*-help.xml'
37+
38+
if ($HelpFile.Directory -notmatch 'en-us|\w{1,2}-\w{1,2}') {
39+
$PSCmdlet.WriteError(
40+
[System.Management.Automation.ErrorRecord]::new(
41+
[IO.FileNotFoundException]::new("Help files are missing!"),
42+
'Build.HelpXmlMissing',
43+
'ObjectNotFound',
44+
$null
45+
)
46+
)
47+
48+
exit 404
49+
}
50+
3651
$DeploymentParams = @{
3752
Path = $Path
3853
Recurse = $false

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- task: PublishPipelineArtifact@1
2727
displayName: 'Publish Built Module Artifact'
2828
inputs:
29-
path: '$(System.DefaultWorkingDirectory)/PSKoans'
29+
path: '$(BuiltModuleFolder)/PSKoans'
3030
artifact: PSKoans
3131

3232
- job: Windows

0 commit comments

Comments
 (0)