|
| 1 | +name: Generate Weave Reference Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + weave_version: |
| 7 | + description: 'Weave version (e.g., "latest", "0.51.34", "v0.51.34", commit SHA, or branch name)' |
| 8 | + required: false |
| 9 | + default: 'latest' |
| 10 | + type: string |
| 11 | + |
| 12 | +jobs: |
| 13 | + generate-docs: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: '3.11' |
| 26 | + |
| 27 | + - name: Set up Node.js |
| 28 | + uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: '18' |
| 31 | + |
| 32 | + - name: Cache Python dependencies |
| 33 | + uses: actions/cache@v4 |
| 34 | + with: |
| 35 | + path: ~/.cache/pip |
| 36 | + key: ${{ runner.os }}-pip-${{ hashFiles('scripts/reference-generation/requirements.txt') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-pip- |
| 39 | + |
| 40 | + - name: Install requests for Service API generation |
| 41 | + run: | |
| 42 | + pip install requests |
| 43 | + |
| 44 | + - name: Set version variable |
| 45 | + id: version |
| 46 | + run: | |
| 47 | + VERSION="${{ github.event.inputs.weave_version }}" |
| 48 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 49 | + echo "Using Weave version: ${VERSION}" |
| 50 | + |
| 51 | + # Generate timestamp |
| 52 | + TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC") |
| 53 | + echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT |
| 54 | + echo "Generated at: ${TIMESTAMP}" |
| 55 | + |
| 56 | + - name: Generate Service API Documentation |
| 57 | + run: | |
| 58 | + echo "Generating Service API documentation..." |
| 59 | + python scripts/reference-generation/generate_service_api_spec.py |
| 60 | + |
| 61 | + - name: Generate Python SDK Documentation |
| 62 | + run: | |
| 63 | + echo "Generating Python SDK documentation..." |
| 64 | + VERSION="${{ steps.version.outputs.version }}" |
| 65 | + echo "Using Weave version: ${VERSION}" |
| 66 | + |
| 67 | + # Create isolated environment for Python SDK generation |
| 68 | + python -m venv venv_python |
| 69 | + source venv_python/bin/activate |
| 70 | + pip install requests lazydocs |
| 71 | + python scripts/reference-generation/generate_python_sdk_docs.py "${VERSION:-latest}" |
| 72 | + deactivate |
| 73 | + rm -rf venv_python |
| 74 | + |
| 75 | + - name: Generate TypeScript SDK Documentation |
| 76 | + run: | |
| 77 | + echo "Generating TypeScript SDK documentation..." |
| 78 | + VERSION="${{ steps.version.outputs.version }}" |
| 79 | + echo "Using Weave version: ${VERSION}" |
| 80 | + |
| 81 | + # Create isolated environment for TypeScript SDK generation |
| 82 | + python -m venv venv_typescript |
| 83 | + source venv_typescript/bin/activate |
| 84 | + python scripts/reference-generation/generate_typescript_sdk_docs.py "${VERSION:-latest}" |
| 85 | + deactivate |
| 86 | + rm -rf venv_typescript |
| 87 | + |
| 88 | + - name: Fix broken links |
| 89 | + run: | |
| 90 | + echo "Fixing broken links in documentation..." |
| 91 | + python scripts/reference-generation/fix_broken_links.py |
| 92 | + |
| 93 | + - name: Create Pull Request |
| 94 | + id: create-pr |
| 95 | + uses: peter-evans/create-pull-request@v6 |
| 96 | + with: |
| 97 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + commit-message: "chore: Update reference documentation (Weave ${{ steps.version.outputs.version }})" |
| 99 | + title: "Update Weave reference documentation (Weave ${{ steps.version.outputs.version }})" |
| 100 | + draft: true |
| 101 | + body: | |
| 102 | + This PR updates the reference documentation for Weave. |
| 103 | + |
| 104 | + **Version**: ${{ steps.version.outputs.version }} |
| 105 | + **Generated on**: ${{ steps.version.outputs.timestamp }} |
| 106 | + |
| 107 | + ### Changes |
| 108 | + - Updated Service API documentation from OpenAPI spec |
| 109 | + - Regenerated Python SDK documentation using lazydocs |
| 110 | + - Regenerated TypeScript SDK documentation using typedoc |
| 111 | + - Fixed internal cross-reference links |
| 112 | + |
| 113 | + ### Notes |
| 114 | + - Documentation generation runs in isolated environments |
| 115 | + - All dependencies are development-only and not included in the repository |
| 116 | + - Please review the changes before merging |
| 117 | + branch: update-reference-docs-${{ github.run_number }} |
| 118 | + delete-branch: true |
| 119 | + labels: | |
| 120 | + documentation |
| 121 | + automated |
| 122 | + weave |
| 123 | + |
| 124 | + - name: Display PR Link |
| 125 | + if: steps.create-pr.outputs.pull-request-number |
| 126 | + run: | |
| 127 | + PR_URL="https://github.com/${{ github.repository }}/pull/${{ steps.create-pr.outputs.pull-request-number }}" |
| 128 | + echo "📝 Draft PR created successfully!" |
| 129 | + echo "🔗 Review the changes at: $PR_URL" |
| 130 | + echo "" |
| 131 | + echo "::notice title=Pull Request Created::A draft PR has been created for review: $PR_URL" |
0 commit comments