-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (110 loc) · 4.33 KB
/
docs.yml
File metadata and controls
132 lines (110 loc) · 4.33 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Documentation
on:
workflow_run:
workflows: ['CI']
types:
- completed
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
actions: read
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build-docs:
name: Build documentation
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Get module name
id: module
shell: pwsh
run: |
$manifest = Get-ChildItem -Path src -Filter '*.psd1' -Recurse | Select-Object -First 1
$moduleName = [System.IO.Path]::GetFileNameWithoutExtension($manifest.Name)
echo "name=$moduleName" >> $env:GITHUB_OUTPUT
- name: Download module artifact from CI
if: ${{ github.event_name == 'workflow_run' }}
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with:
name: ${{ steps.module.outputs.name }}-Module
path: Artifacts/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Build module (if artifact not available)
shell: pwsh
run: |
$moduleName = '${{ steps.module.outputs.name }}'
$manifestPath = "Artifacts/$moduleName.psd1"
if (-not [System.IO.File]::Exists($manifestPath)) {
Write-Host 'Module artifact not found, building from source...'
./build.ps1 -Build
} else {
Write-Host 'Using module artifact from CI'
}
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
- name: Cache PowerShell modules
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: ~/.local/share/powershell/Modules
key: ${{ runner.os }}-psmodules-${{ hashFiles('install_modules.ps1') }}
- name: Install PowerShell modules
shell: pwsh
run: ./install_modules.ps1
- name: Check documentation infrastructure
id: check_docs
shell: pwsh
run: |
$hasRequirements = [System.IO.File]::Exists('docs/requirements.txt')
$hasMkdocs = [System.IO.File]::Exists('mkdocs.yml')
$hasDocGen = [System.IO.File]::Exists('.build/Invoke-DocumentationGeneration.ps1')
$ready = $hasRequirements -and $hasMkdocs -and $hasDocGen
echo "ready=$($ready.ToString().ToLower())" >> $env:GITHUB_OUTPUT
if (-not $ready) {
Write-Host '::warning::Documentation infrastructure incomplete'
Write-Host " requirements.txt: $hasRequirements"
Write-Host " mkdocs.yml: $hasMkdocs"
Write-Host " Invoke-DocumentationGeneration.ps1: $hasDocGen"
}
- name: Generate function documentation
if: steps.check_docs.outputs.ready == 'true'
shell: pwsh
run: ./.build/Invoke-DocumentationGeneration.ps1 -ModuleName ${{ steps.module.outputs.name }} -Force
- name: Setup Python
if: steps.check_docs.outputs.ready == 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.11'
cache: 'pip'
- name: Install MkDocs dependencies
if: steps.check_docs.outputs.ready == 'true'
run: pip install -r docs/requirements.txt
- name: Build MkDocs site
if: steps.check_docs.outputs.ready == 'true'
run: mkdocs build --strict
- name: Upload artifact
if: steps.check_docs.outputs.ready == 'true'
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
with:
path: site/
deploy-docs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build-docs
if: success()
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e