-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (83 loc) · 2.8 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
104 lines (83 loc) · 2.8 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
name: Documentation Quality & Deployment
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Validate
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0 # gitleaks-action needs full history to resolve the push diff range
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Lint markdown files
run: |
npm install -g markdownlint-cli
markdownlint --config .markdownlint.json 'docs/**/*.md' 'commands/**/*.md'
- name: Validate command conventions
run: python3 scripts/validate-conventions.py
- name: Run Python tests
run: |
python3 -m pip install --quiet pytest pyyaml
python3 -m pytest tests/ -q
- name: Scan for secrets (gitleaks)
uses: gitleaks/gitleaks-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build Documentation
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install mdbook
env:
MDBOOK_VERSION: "0.5.2"
run: |
curl -sL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar xz -C /usr/local/bin
- name: Install mdbook-mermaid
env:
MERMAID_VERSION: "0.17.0"
run: |
curl -sL "https://github.com/badboy/mdbook-mermaid/releases/download/v${MERMAID_VERSION}/mdbook-mermaid-v${MERMAID_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar xz -C /usr/local/bin
- name: Build mdbook
run: ./scripts/build-mdbook.sh
- name: Check internal links
run: python3 scripts/check-links.py
- name: Configure Pages
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
uses: actions/configure-pages@v6
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
uses: actions/upload-pages-artifact@v5
with:
path: mdbook-out
deploy:
name: Deploy to GitHub Pages
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5