-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathGet-GeneratedReadmes.ps1
69 lines (57 loc) · 2.85 KB
/
Get-GeneratedReadmes.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env pwsh
param(
[switch] $Validate,
[string] $Branch
)
$ErrorActionPreference = 'Stop'
Import-Module -force $PSScriptRoot/../DependencyManagement.psm1
if ($Validate) {
$customImageBuilderArgs = " --validate"
}
$repoRoot = (Get-Item "$PSScriptRoot").Parent.Parent.FullName
function CopyReadme([string]$containerName, [string]$readmeRelativePath) {
$readmeDir = Split-Path $readmeRelativePath -Parent
Exec "docker cp ${containerName}:/repo/$readmeRelativePath $repoRoot/$readmeDir"
}
$onDockerfilesGenerated = {
param($ContainerName)
if (-Not $Validate) {
CopyReadme $ContainerName "README.aspire-dashboard.md"
CopyReadme $ContainerName "README.aspnet.md"
CopyReadme $ContainerName "README.md"
CopyReadme $ContainerName "README.monitor.md"
CopyReadme $ContainerName "README.monitor-base.md"
CopyReadme $ContainerName "README.runtime-deps.md"
CopyReadme $ContainerName "README.runtime.md"
CopyReadme $ContainerName "README.samples.md"
CopyReadme $ContainerName "README.sdk.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.aspire-dashboard.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.aspnet.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.monitor.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.monitor-base.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.runtime-deps.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.runtime.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.samples.md"
CopyReadme $ContainerName ".portal-docs/docker-hub/README.sdk.md"
CopyReadme $ContainerName ".portal-docs/mar/README.aspire-dashboard.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.aspnet.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.monitor.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.monitor-base.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.runtime-deps.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.runtime.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.samples.portal.md"
CopyReadme $ContainerName ".portal-docs/mar/README.sdk.portal.md"
}
}
function Invoke-GenerateReadme {
param ([string] $Manifest, [string] $SourceBranch)
& $PSScriptRoot/../common/Invoke-ImageBuilder.ps1 `
-ImageBuilderArgs `
"generateReadmes --manifest $Manifest --source-branch $SourceBranch$customImageBuilderArgs --var branch=$SourceBranch 'https://github.com/dotnet/dotnet-docker'" `
-OnCommandExecuted $onDockerfilesGenerated
}
if (!$Branch) {
$Branch = Get-Branch
}
Invoke-GenerateReadme "manifest.json" $Branch
Invoke-GenerateReadme "manifest.samples.json" "main"