Skip to content

Test documentation pipeline #5

Test documentation pipeline

Test documentation pipeline #5

Workflow file for this run

name: Documentation
true:
pull_request:
branches:
- main
paths:
- crates/q_cli/**
- docs/**
- .github/workflows/documentation.yml
push:
branches:
- main
paths:
- crates/q_cli/**
- docs/**
- .github/workflows/documentation.yml
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
'
- 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-region: us-west-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Enhance documentation with Bedrock
run: python scripts/enhance_docs_bedrock.py --input-dir docs/generated --code-dir
. --output-dir docs/enhanced
- 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\n cp -r docs/enhanced/* docs/src/\n\n# Create book.toml\n\
cat > docs/book.toml << EOF\n[book]\ntitle = \"Amazon Q Developer CLI Documentation\"\
\nauthors = [\"AWS\"]\ndescription = \"Documentation for the Amazon Q Developer\
\ CLI\"\nsrc = \"src\"\n\n[output.html]\ngit-repository-url = \"https://github.com/aws/amazon-q-developer-cli\"\
\ngit-repository-icon = \"fa-github\"\nsite-url = \"/\"\nEOF\n\n# Create SUMMARY.md\n\
echo \"# Summary\" > docs/src/SUMMARY.md\necho \"\" >> docs/src/SUMMARY.md\n\
echo \"[Introduction](README.md)\" >> docs/src/SUMMARY.md\necho \"\" >> docs/src/SUMMARY.md\n\
echo \"# Commands\" >> docs/src/SUMMARY.md\n\n# Add all command files to SUMMARY.md\n\
find docs/src -name \"*.md\" -not -path \"*/\\.*\" -not -name \"SUMMARY.md\"\
\ -not -name \"README.md\" | sort | while read -r file; do\n filename=$(basename\
\ \"$file\")\n title=$(head -n 1 \"$file\" | sed 's/^# //')\n if [ \"$filename\"\
\ != \"index.md\" ]; then\n echo \"- [$title]($filename)\" >> docs/src/SUMMARY.md\n\
\ fi\ndone\n\n# Create README.md if it doesn't exist\nif [ ! -f \"docs/src/README.md\"\
\ ]; then\n if [ -f \"docs/src/index.md\" ]; then\n cp docs/src/index.md\
\ docs/src/README.md\n else\n cat > docs/src/README.md << EOF\n# Amazon\
\ Q Developer CLI Documentation\n\nWelcome to the Amazon Q Developer CLI documentation.\
\ This site contains reference documentation for all Amazon Q CLI commands.\n\
\n## Available Commands\n\nSee the sidebar for a complete list of available\
\ commands.\nEOF\n fi\nfi\n"
- 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:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build-docs
runs-on: ubuntu-latest
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
'