1+ name : Documentation
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ paths :
7+ - ' docs/**'
8+ - ' README.md'
9+ - ' *.md'
10+ - ' .github/workflows/docs.yml'
11+ pull_request :
12+ branches : [ main ]
13+ paths :
14+ - ' docs/**'
15+ - ' README.md'
16+ - ' *.md'
17+ - ' .github/workflows/docs.yml'
18+ workflow_dispatch :
19+
20+ permissions :
21+ contents : read
22+ pages : write
23+ id-token : write
24+
25+ # Allow one concurrent deployment
26+ concurrency :
27+ group : " pages"
28+ cancel-in-progress : true
29+
30+ jobs :
31+ # Lint and validate documentation
32+ lint-docs :
33+ name : Lint Documentation
34+ runs-on : ubuntu-latest
35+
36+ steps :
37+ - name : Checkout
38+ uses : actions/checkout@v4
39+
40+ - name : Setup Node.js
41+ uses : actions/setup-node@v4
42+ with :
43+ node-version : ' 18'
44+
45+ - name : Install markdownlint
46+ run : |
47+ npm install -g markdownlint-cli2
48+ npm install -g markdown-link-check
49+
50+ - name : Lint Markdown files
51+ run : |
52+ markdownlint-cli2 "**/*.md" "#node_modules" "#.git"
53+
54+ - name : Check markdown links
55+ run : |
56+ find . -name "*.md" -not -path "./node_modules/*" -not -path "./.git/*" | \
57+ xargs -I {} markdown-link-check {} --config .github/markdown-link-check.json || true
58+
59+ - name : Validate action.yml
60+ run : |
61+ # Check if action.yml is valid YAML
62+ python3 -c "import yaml; yaml.safe_load(open('action.yml'))"
63+ echo "β
action.yml is valid YAML"
64+
65+ - name : Check for broken internal links
66+ run : |
67+ echo "π Checking for broken internal links..."
68+
69+ # Find all markdown files
70+ find . -name "*.md" -not -path "./node_modules/*" -not -path "./.git/*" > md_files.txt
71+
72+ # Extract internal links (relative paths)
73+ grep -h -o '\[.*\](\..*\.md)' $(cat md_files.txt) | \
74+ sed 's/.*](\(.*\))/\1/' | \
75+ sort -u > internal_links.txt || echo "No internal links found"
76+
77+ # Check if linked files exist
78+ missing_files=()
79+ while IFS= read -r link; do
80+ if [[ -n "$link" && ! -f "$link" ]]; then
81+ missing_files+=("$link")
82+ fi
83+ done < internal_links.txt
84+
85+ if [[ ${#missing_files[@]} -gt 0 ]]; then
86+ echo "β Missing files referenced in documentation:"
87+ printf '%s\n' "${missing_files[@]}"
88+ exit 1
89+ else
90+ echo "β
All internal links are valid"
91+ fi
92+
93+ # Spell check documentation
94+ spell-check :
95+ name : Spell Check
96+ runs-on : ubuntu-latest
97+
98+ steps :
99+ - name : Checkout
100+ uses : actions/checkout@v4
101+
102+ - name : Install cspell
103+ run : npm install -g cspell
104+
105+ - name : Run spell check
106+ run : |
107+ # Create custom dictionary for technical terms
108+ cat << 'EOF' > .cspell.json
109+ {
110+ "version": "0.2",
111+ "language": "en",
112+ "words": [
113+ "kubectl", "helm", "kubernetes", "kubeconfig", "eks", "aws", "iam",
114+ "vpc", "ecr", "artifactory", "nexus", "harbor", "bitnami",
115+ "dockerfile", "github", "yaml", "json", "ssl", "tls",
116+ "dinushchathurya", "srilanka", "oidc", "rbac", "cidr",
117+ "eksctl", "cloudtrail", "cloudformation", "terraform",
118+ "nginx", "postgresql", "redis", "autoscaling", "loadbalancer"
119+ ],
120+ "dictionaries": ["typescript", "node", "software-terms"],
121+ "ignorePaths": [
122+ "node_modules/**",
123+ ".git/**",
124+ "**/*.log"
125+ ]
126+ }
127+ EOF
128+
129+ # Run spell check on markdown files
130+ cspell "**/*.md" --no-progress || echo "Spell check completed with warnings"
131+
132+ # Generate documentation site
133+ build-docs :
134+ name : Build Documentation Site
135+ runs-on : ubuntu-latest
136+ needs : [lint-docs]
137+ if : github.ref == 'refs/heads/main'
138+
139+ steps :
140+ - name : Checkout
141+ uses : actions/checkout@v4
142+
143+ - name : Setup Pages
144+ uses : actions/configure-pages@v4
145+
146+ - name : Setup Node.js
147+ uses : actions/setup-node@v4
148+ with :
149+ node-version : ' 18'
150+
151+ - name : Install dependencies
152+ run : |
153+ npm install -g @vuepress/cli @vuepress/theme-default
154+
155+ - name : Create VuePress config
156+ run : |
157+ mkdir -p .vuepress
158+ cat << 'EOF' > .vuepress/config.js
159+ module.exports = {
160+ title: 'EKS Helm Client',
161+ description: 'Deploy Helm charts to EKS clusters with private infrastructure support',
162+ base: '/eks-helm-client-github-action/',
163+ themeConfig: {
164+ repo: 'open-source-srilanka/eks-helm-client-github-action',
165+ editLinks: true,
166+ editLinkText: 'Edit this page on GitHub',
167+ lastUpdated: 'Last Updated',
168+ nav: [
169+ { text: 'Home', link: '/' },
170+ { text: 'Examples', link: '/docs/examples/' },
171+ { text: 'Migration', link: '/docs/MIGRATION' },
172+ { text: 'Contributing', link: '/docs/CONTRIBUTING' },
173+ { text: 'GitHub', link: 'https://github.com/open-source-srilanka/eks-helm-client-github-action' }
174+ ],
175+ sidebar: {
176+ '/docs/': [
177+ {
178+ title: 'Guide',
179+ collapsable: false,
180+ children: [
181+ '',
182+ 'MIGRATION',
183+ 'CONTRIBUTING',
184+ 'SECURITY'
185+ ]
186+ },
187+ {
188+ title: 'Examples',
189+ collapsable: false,
190+ children: [
191+ 'examples/',
192+ 'examples/basic-usage',
193+ 'examples/private-cluster',
194+ 'examples/private-registry',
195+ 'examples/advanced-scenarios',
196+ 'examples/troubleshooting'
197+ ]
198+ }
199+ ]
200+ }
201+ }
202+ }
203+ EOF
204+
205+ - name : Create docs index
206+ run : |
207+ cat << 'EOF' > docs/README.md
208+ # EKS Helm Client Documentation
209+
210+ Welcome to the comprehensive documentation for EKS Helm Client GitHub Action v2.0.0.
211+
212+ ## Quick Navigation
213+
214+ - [Basic Usage Examples](examples/basic-usage.md)
215+ - [Private EKS Clusters](examples/private-cluster.md)
216+ - [Private Helm Registries](examples/private-registry.md)
217+ - [Advanced Scenarios](examples/advanced-scenarios.md)
218+ - [Troubleshooting Guide](examples/troubleshooting.md)
219+ - [Migration Guide](MIGRATION.md)
220+ - [Contributing](CONTRIBUTING.md)
221+ - [Security Policy](SECURITY.md)
222+
223+ ## Features
224+
225+ - π Private EKS cluster support
226+ - π’ Private Helm repository authentication
227+ - π‘οΈ Enhanced security features
228+ - β‘ Configurable tool versions
229+ - π Debug mode and troubleshooting
230+ - π§ͺ Dry run testing capabilities
231+
232+ ## Getting Started
233+
234+ Check out our [Basic Usage Examples](examples/basic-usage.md) to get started quickly.
235+ EOF
236+
237+ - name : Build documentation
238+ run : |
239+ # Copy README to docs root
240+ cp README.md docs/index.md
241+
242+ # Build static site (fallback to simple HTML if VuePress fails)
243+ npx vuepress build . || {
244+ echo "VuePress build failed, creating simple HTML structure"
245+ mkdir -p _site
246+
247+ # Create simple index.html
248+ cat << 'EOF' > _site/index.html
249+ <!DOCTYPE html>
250+ <html>
251+ <head>
252+ <title>EKS Helm Client Documentation</title>
253+ <meta charset="utf-8">
254+ <meta name="viewport" content="width=device-width, initial-scale=1">
255+ <style>
256+ body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; }
257+ .nav { background: #f8f9fa; padding: 10px; border-radius: 5px; margin-bottom: 20px; }
258+ .nav a { margin-right: 15px; text-decoration: none; color: #0366d6; }
259+ .content { line-height: 1.6; }
260+ pre { background: #f6f8fa; padding: 15px; border-radius: 5px; overflow-x: auto; }
261+ code { background: #f6f8fa; padding: 2px 4px; border-radius: 3px; }
262+ </style>
263+ </head>
264+ <body>
265+ <div class="nav">
266+ <a href="#quick-start">Quick Start</a>
267+ <a href="#examples">Examples</a>
268+ <a href="#docs">Documentation</a>
269+ <a href="https://github.com/open-source-srilanka/eks-helm-client-github-action">GitHub</a>
270+ </div>
271+ <div class="content">
272+ <h1>EKS Helm Client Documentation</h1>
273+ <p>Deploy Helm charts to EKS clusters with private infrastructure support.</p>
274+
275+ <h2 id="quick-start">Quick Start</h2>
276+ <pre><code>- name: Deploy to EKS
277+ uses: open-source-srilanka/eks-helm-client-github-action@v2.0.0
278+ with:
279+ cluster-name: my-cluster
280+ region: us-west-2
281+ args: |
282+ helm repo add bitnami https://charts.bitnami.com/bitnami
283+ helm upgrade --install my-app bitnami/nginx</code></pre>
284+
285+ <h2 id="examples">Examples</h2>
286+ <ul>
287+ <li><a href="docs/examples/basic-usage.html">Basic Usage</a></li>
288+ <li><a href="docs/examples/private-cluster.html">Private EKS Clusters</a></li>
289+ <li><a href="docs/examples/private-registry.html">Private Helm Registries</a></li>
290+ </ul>
291+
292+ <h2 id="docs">Documentation</h2>
293+ <ul>
294+ <li><a href="docs/MIGRATION.html">Migration Guide</a></li>
295+ <li><a href="docs/CONTRIBUTING.html">Contributing</a></li>
296+ <li><a href="docs/SECURITY.html">Security Policy</a></li>
297+ </ul>
298+ </div>
299+ </body>
300+ </html>
301+ EOF
302+
303+ # Convert markdown files to basic HTML
304+ find docs -name "*.md" | while read -r file; do
305+ html_file="_site/${file%.md}.html"
306+ mkdir -p "$(dirname "$html_file")"
307+
308+ echo "<!DOCTYPE html><html><head><title>$(basename "$file" .md)</title><meta charset='utf-8'><style>body{font-family:sans-serif;max-width:1200px;margin:0 auto;padding:20px;line-height:1.6}pre{background:#f6f8fa;padding:15px;border-radius:5px}</style></head><body>" > "$html_file"
309+
310+ # Simple markdown to HTML conversion
311+ sed 's/^# \(.*\)/<h1>\1<\/h1>/g; s/^## \(.*\)/<h2>\1<\/h2>/g; s/^### \(.*\)/<h3>\1<\/h3>/g' "$file" >> "$html_file"
312+
313+ echo "</body></html>" >> "$html_file"
314+ done
315+ }
316+
317+ - name : Upload artifact
318+ uses : actions/upload-pages-artifact@v3
319+ with :
320+ path : ' .vuepress/dist'
321+
322+ # Deploy to GitHub Pages
323+ deploy-docs :
324+ name : Deploy Documentation
325+ runs-on : ubuntu-latest
326+ needs : build-docs
327+ if : github.ref == 'refs/heads/main'
328+
329+ environment :
330+ name : github-pages
331+ url : ${{ steps.deployment.outputs.page_url }}
332+
333+ steps :
334+ - name : Deploy to GitHub Pages
335+ id : deployment
336+ uses : actions/deploy-pages@v4
337+
338+ # Generate documentation summary
339+ docs-summary :
340+ name : Documentation Summary
341+ runs-on : ubuntu-latest
342+ needs : [lint-docs, spell-check]
343+ if : always()
344+
345+ steps :
346+ - name : Generate Summary
347+ run : |
348+ echo "# π Documentation Workflow Summary" >> $GITHUB_STEP_SUMMARY
349+ echo "" >> $GITHUB_STEP_SUMMARY
350+
351+ echo "## π Results" >> $GITHUB_STEP_SUMMARY
352+ echo "" >> $GITHUB_STEP_SUMMARY
353+ echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY
354+ echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
355+ echo "| Markdown Linting | ${{ needs.lint-docs.result == 'success' && 'β
Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
356+ echo "| Spell Check | ${{ needs.spell-check.result == 'success' && 'β
Passed' || 'β οΈ Warnings' }} |" >> $GITHUB_STEP_SUMMARY
357+
358+ if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
359+ echo "| Documentation Build | ${{ needs.build-docs.result == 'success' && 'β
Deployed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY
360+ echo "" >> $GITHUB_STEP_SUMMARY
361+ echo "## π Links" >> $GITHUB_STEP_SUMMARY
362+ echo "- [π Documentation Site](https://open-source-srilanka.github.io/eks-helm-client-github-action/)" >> $GITHUB_STEP_SUMMARY
363+ fi
364+
365+ echo "" >> $GITHUB_STEP_SUMMARY
366+ echo "## π Documentation Files" >> $GITHUB_STEP_SUMMARY
367+ echo "- README.md" >> $GITHUB_STEP_SUMMARY
368+ echo "- CHANGELOG.md" >> $GITHUB_STEP_SUMMARY
369+ echo "- docs/MIGRATION.md" >> $GITHUB_STEP_SUMMARY
370+ echo "- docs/CONTRIBUTING.md" >> $GITHUB_STEP_SUMMARY
371+ echo "- docs/SECURITY.md" >> $GITHUB_STEP_SUMMARY
372+ echo "- docs/examples/*.md" >> $GITHUB_STEP_SUMMARY
0 commit comments