Skip to content

Commit 2bd345c

Browse files
committed
docs: create mkdocs site
1 parent 63c4d4f commit 2bd345c

34 files changed

Lines changed: 4556 additions & 4236 deletions

.github/workflows/deploy_docs.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Workflow for building and deploying MkDocs documentation with Terraform docs to GitHub Pages
2+
name: Deploy Documentation to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: [main]
8+
paths:
9+
- 'docs/**'
10+
- 'mkdocs.yml'
11+
- '*.tf'
12+
- 'modules/**/*.tf'
13+
- 'schemas/**'
14+
- '.github/workflows/deploy_docs.yml'
15+
16+
pull_request:
17+
types: [opened, synchronize]
18+
paths:
19+
- 'docs/**'
20+
- 'mkdocs.yml'
21+
- '*.tf'
22+
- 'modules/**/*.tf'
23+
- 'schemas/**'
24+
25+
# Allows you to run this workflow manually from the Actions tab
26+
workflow_dispatch:
27+
28+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
29+
permissions:
30+
contents: read
31+
pages: write
32+
id-token: write
33+
34+
# Allow one concurrent deployment
35+
concurrency:
36+
group: "pages"
37+
cancel-in-progress: true
38+
39+
# Default to bash
40+
defaults:
41+
run:
42+
shell: bash
43+
44+
jobs:
45+
# Build job
46+
build:
47+
runs-on: ubuntu-latest
48+
env:
49+
TERRAFORM_DOCS_VERSION: v0.20.0
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
with:
54+
fetch-depth: 0 # Full history for git revision dates
55+
56+
- name: Setup Python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.12'
60+
cache: 'pip'
61+
cache-dependency-path: 'docs/requirements.txt'
62+
63+
- name: Install MkDocs and dependencies
64+
run: |
65+
pip install -r docs/requirements.txt
66+
67+
- name: Install terraform-docs
68+
run: |
69+
wget -O /tmp/terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/${TERRAFORM_DOCS_VERSION}/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz
70+
tar -xzf /tmp/terraform-docs.tar.gz -C /tmp
71+
sudo mv /tmp/terraform-docs /usr/local/bin/
72+
chmod +x /usr/local/bin/terraform-docs
73+
terraform-docs --version
74+
75+
- name: Generate Terraform documentation
76+
run: |
77+
# Generate main module docs
78+
terraform-docs markdown table . > docs/reference/terraform.md
79+
80+
# Generate submodule docs
81+
for dir in modules/*/; do
82+
module_name=$(basename $dir)
83+
terraform-docs markdown table $dir > docs/reference/module-${module_name}.md
84+
done
85+
86+
- name: Setup Pages
87+
id: pages
88+
uses: actions/configure-pages@v5
89+
90+
- name: Build with MkDocs
91+
run: |
92+
mkdocs build --strict --site-dir ./site
93+
94+
- name: Upload artifact
95+
uses: actions/upload-pages-artifact@v3
96+
with:
97+
path: ./site
98+
99+
# Deployment job
100+
deploy:
101+
if: github.event_name == 'push' || github.event.pull_request.merged == true
102+
environment:
103+
name: github-pages
104+
url: ${{ steps.deployment.outputs.page_url }}
105+
runs-on: ubuntu-latest
106+
needs: build
107+
steps:
108+
- name: Deploy to GitHub Pages
109+
id: deployment
110+
uses: actions/deploy-pages@v4

.github/workflows/docs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- 'mkdocs.yml'
10+
- '**.tf'
11+
- 'schemas/**'
12+
- '.github/workflows/docs.yml'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0 # Fetch all history for git-revision-date-localized plugin
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.12'
31+
32+
- name: Cache Python dependencies
33+
uses: actions/cache@v3
34+
with:
35+
path: ~/.cache/pip
36+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
37+
restore-keys: |
38+
${{ runner.os }}-pip-
39+
40+
- name: Install dependencies
41+
run: |
42+
pip install mkdocs-material
43+
pip install mkdocs-git-revision-date-localized-plugin
44+
45+
- name: Install terraform-docs
46+
run: |
47+
wget https://github.com/terraform-docs/terraform-docs/releases/download/v0.20.0/terraform-docs-v0.20.0-linux-amd64.tar.gz
48+
tar -xzf terraform-docs-v0.20.0-linux-amd64.tar.gz
49+
sudo mv terraform-docs /usr/local/bin/
50+
terraform-docs --version
51+
52+
- name: Generate Terraform documentation
53+
run: |
54+
# Generate main module docs
55+
terraform-docs markdown table . > docs/reference/terraform.md
56+
57+
# Generate submodule docs
58+
for dir in modules/*/; do
59+
module_name=$(basename $dir)
60+
echo "Generating docs for module: $module_name"
61+
terraform-docs markdown table $dir > docs/reference/module-${module_name}.md
62+
done
63+
64+
- name: Commit updated Terraform docs
65+
run: |
66+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
67+
git config --local user.name "github-actions[bot]"
68+
git add docs/reference/*.md
69+
git diff --quiet && git diff --staged --quiet || git commit -m "docs: auto-update terraform reference"
70+
continue-on-error: true
71+
72+
- name: Build and deploy MkDocs
73+
run: mkdocs gh-deploy --force

.github/workflows/terraform-validate.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)