Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish External Help with module #319

Merged
merged 3 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Build/Psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ $Lines
# Bump the module version if we didn't already
try {
$GalleryVersion = Get-NextNugetPackageVersion -Name $env:BHProjectName -ErrorAction Stop
$GithubVersion = Get-MetaData -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -ErrorAction Stop
$GithubVersion = Get-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -ErrorAction Stop
if ($GalleryVersion -ge $GithubVersion) {
Update-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -Value $GalleryVersion -ErrorAction stop
}
Expand All @@ -104,4 +104,9 @@ Continuing with existing version.

# Build external help files from Platyps MD files
New-ExternalHelp -Path "$ProjectRoot/docs/" -OutputPath "$ProjectRoot/PSKoans/en-us"

$BuiltModuleFolder = "$ProjectRoot/BuiltModule/"
Write-Host "##vso[task.setvariable variable=BuiltModuleFolder]$BuiltModuleFolder"
New-Item -Path $BuiltModuleFolder -ItemType Directory
Copy-Item -Path "$ProjectRoot/PSKoans" -Destination $BuiltModuleFolder -Recurse -PassThru
}
4 changes: 2 additions & 2 deletions Deploy/FileSystem/PSKoans.psdeploy.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Deploy Module {
By PSGalleryModule {
FromSource PSKoans
FromSource "$PSScriptRoot/PSKoans"
To FileSystem
WithOptions @{
ApiKey = $ENV:NugetApiKey
ApiKey = 'FileSystem'
}
}
}
2 changes: 1 addition & 1 deletion Deploy/PSGallery/PSKoans.psdeploy.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Deploy Module {
By PSGalleryModule {
FromSource PSKoans
FromSource "$PSScriptRoot/PSKoans"
To PSGallery
WithOptions @{
ApiKey = $ENV:NugetApiKey
Expand Down
17 changes: 16 additions & 1 deletion Deploy/Publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ param(
$OutputDirectory
)

$ENV:NugetApiKey = $Key
$env:NugetApiKey = $Key

if ($OutputDirectory) {
$Params = @{
Expand All @@ -33,6 +33,21 @@ if ($OutputDirectory) {
}
}

$HelpFile = Get-ChildItem -Path $Path -File -Recurse -Filter '*-help.xml'

if ($HelpFile.Directory -notmatch 'en-us|\w{1,2}-\w{1,2}') {
$PSCmdlet.WriteError(
[System.Management.Automation.ErrorRecord]::new(
[IO.FileNotFoundException]::new("Help files are missing!"),
'Build.HelpXmlMissing',
'ObjectNotFound',
$null
)
)

exit 404
}

$DeploymentParams = @{
Path = $Path
Recurse = $false
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- task: PublishPipelineArtifact@1
displayName: 'Publish Built Module Artifact'
inputs:
path: '$(System.DefaultWorkingDirectory)/PSKoans'
path: '$(BuiltModuleFolder)/PSKoans'
artifact: PSKoans

- job: Windows
Expand Down