-
Notifications
You must be signed in to change notification settings - Fork 4
138 lines (114 loc) · 3.24 KB
/
docs.yml
File metadata and controls
138 lines (114 loc) · 3.24 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
133
134
135
136
137
138
---
name: Documentation
"on":
push:
branches: [main]
paths:
- 'docs/**'
- 'examples/**'
- '*.md'
- '.github/workflows/docs.yml'
pull_request:
branches: [main]
paths:
- 'docs/**'
- 'examples/**'
- '*.md'
- '.github/workflows/docs.yml'
permissions:
contents: read
pages: write
id-token: write
jobs:
# Generate and validate provider documentation
generate-docs:
name: Generate Provider Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
- name: Install tfplugindocs
run: >
go install
github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
- name: Generate documentation
run: tfplugindocs generate
- name: Check for documentation changes
run: |
if ! git diff --exit-code docs/; then
echo "Documentation is out of date."
echo "Please run 'tfplugindocs generate' and commit changes."
git diff docs/
exit 1
fi
# Validate examples
validate-examples:
name: Validate Examples
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: latest
- name: Validate example configurations
run: >
find examples -name "*.tf"
-execdir terraform init -backend=false \;
-execdir terraform validate \;
- name: Check Terraform formatting
run: >
find examples -name "*.tf"
-exec terraform fmt -check=true -diff=true {} \;
# Documentation site deployment (GitHub Pages)
deploy-docs:
name: Deploy Documentation Site
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [generate-docs, validate-examples]
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: Install documentation dependencies
run: |
cd docs
npm ci
- name: Build documentation site
run: |
cd docs
npm run build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs/build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# Check documentation links
link-check:
name: Documentation Link Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Check markdown links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
config-file: '.github/mlc_config.json'
folder-path: 'docs, examples'
file-path: './README.md, ./CONTRIBUTING.md, ./CHANGELOG.md'