-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (62 loc) · 2.22 KB
/
docs.yml
File metadata and controls
73 lines (62 loc) · 2.22 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
name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- '**.tf'
- 'schemas/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git-revision-date-localized plugin
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install mkdocs-material
pip install mkdocs-git-revision-date-localized-plugin
- name: Install terraform-docs
run: |
wget https://github.com/terraform-docs/terraform-docs/releases/download/v0.20.0/terraform-docs-v0.20.0-linux-amd64.tar.gz
tar -xzf terraform-docs-v0.20.0-linux-amd64.tar.gz
sudo mv terraform-docs /usr/local/bin/
terraform-docs --version
- name: Generate Terraform documentation
run: |
# Generate main module docs
terraform-docs markdown table . > docs/reference/terraform.md
# Generate submodule docs
for dir in modules/*/; do
module_name=$(basename $dir)
echo "Generating docs for module: $module_name"
terraform-docs markdown table $dir > docs/reference/module-${module_name}.md
done
- name: Commit updated Terraform docs
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add docs/reference/*.md
git diff --quiet && git diff --staged --quiet || git commit -m "docs: auto-update terraform reference"
continue-on-error: true
- name: Build and deploy MkDocs
run: mkdocs gh-deploy --force