forked from aws/amazon-q-developer-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (123 loc) · 4.63 KB
/
documentation.yml
File metadata and controls
149 lines (123 loc) · 4.63 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
139
140
141
142
143
144
145
146
147
148
149
name: Documentation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install markdown pyyaml
- name: Generate documentation
run: |
mkdir -p docs/generated
python scripts/extract_docs.py
# Add the documentation enhancement steps
- name: Install documentation enhancement dependencies
run: python -m pip install boto3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Enhance documentation with Bedrock
run: |
mkdir -p docs/enhanced
python scripts/enhance_docs_bedrock.py --input-dir docs/generated --code-dir . --output-dir docs/enhanced --model anthropic.claude-3-5-sonnet-20240620-v1:0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install mdBook
run: |
cargo install mdbook
- name: Setup mdBook structure
run: |
mkdir -p docs/src
# Use enhanced docs instead of generated docs
cp -r docs/enhanced/* docs/src/
# Create book.toml
cat > docs/book.toml << EOF
[book]
title = "Amazon Q Developer CLI Documentation"
authors = ["AWS"]
description = "Documentation for the Amazon Q Developer CLI"
src = "src"
[output.html]
git-repository-url = "https://github.com/aws/amazon-q-developer-cli"
git-repository-icon = "fa-github"
site-url = "/"
EOF
# Create SUMMARY.md
echo "# Summary" > docs/src/SUMMARY.md
echo "" >> docs/src/SUMMARY.md
echo "[Introduction](README.md)" >> docs/src/SUMMARY.md
echo "" >> docs/src/SUMMARY.md
echo "# Commands" >> docs/src/SUMMARY.md
# Add all command files to SUMMARY.md
find docs/src -name "*.md" -not -path "*/\.*" -not -name "SUMMARY.md" -not -name "README.md" | sort | while read -r file; do
filename=$(basename "$file")
title=$(head -n 1 "$file" | sed 's/^# //')
if [ "$filename" != "index.md" ]; then
echo "- [$title]($filename)" >> docs/src/SUMMARY.md
fi
done
# Create README.md if it doesn't exist
if [ ! -f "docs/src/README.md" ]; then
if [ -f "docs/src/index.md" ]; then
cp docs/src/index.md docs/src/README.md
else
cat > docs/src/README.md << EOF
# Amazon Q Developer CLI Documentation
Welcome to the Amazon Q Developer CLI documentation. This site contains reference documentation for all Amazon Q CLI commands.
## Available Commands
See the sidebar for a complete list of available commands.
EOF
fi
fi
- name: Build mdBook
run: |
cd docs && mdbook build
- name: Upload documentation artifact
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/book
deploy-infrastructure:
needs: build-docs
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Download documentation artifact
uses: actions/download-artifact@v3
with:
name: documentation
path: docs/book
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install CDK dependencies
run: |
cd infrastructure
npm install
- name: Deploy CDK stack
run: |
cd infrastructure
npm run cdk deploy -- --require-approval never
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2