docs: sync API reference updates with Docusaurus on release #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync API reference with Docusaurus | |
| on: | |
| # for testing purposes | |
| pull_request: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+*" | |
| workflow_dispatch: # Activate this workflow manually | |
| inputs: | |
| tag: | |
| description: "Tag with this format: v1.0.0. When running this workflow manually, version is irrelevant so you can use any value." | |
| required: true | |
| type: string | |
| default: v1.0.0 | |
| env: | |
| # TAG: ${{ inputs.tag || github.ref_name }} | |
| # for testing purposes | |
| TAG: v1.0.0 | |
| jobs: | |
| generate-api-reference: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -U haystack-pydoc-tools | |
| - name: Generate API reference | |
| run: ./.github/utils/pydoc-markdown.sh "../config_docusaurus/*" | |
| - name: Upload API reference artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: experimental-api-reference | |
| path: docs/pydoc/temp | |
| if-no-files-found: error | |
| retention-days: 1 | |
| overwrite: true | |
| sync-api-reference: | |
| runs-on: ubuntu-latest | |
| needs: generate-api-reference | |
| steps: | |
| - name: Checkout Haystack repo | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: deepset-ai/haystack | |
| ref: main | |
| token: ${{ secrets.HAYSTACK_BOT_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Download API reference artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: experimental-api-reference | |
| path: temp_api_reference | |
| - name: Sync API reference | |
| run: | | |
| SOURCE_PATH="temp_api_reference" | |
| DEST_PATH="docs-website/reference/experiments-api" | |
| VERSIONED_DEST_PATH="docs-website/reference_versioned_docs" | |
| echo "Syncing from $SOURCE_PATH to $DEST_PATH" | |
| mkdir -p $DEST_PATH | |
| # Using rsync to copy files. This will also remove files in dest that are no longer in source. | |
| rsync -av --delete --exclude='.git/' "$SOURCE_PATH/" "$DEST_PATH/" | |
| echo "Syncing to all versioned documentation paths" | |
| # Check if versioned docs directory exists and find existing version directories | |
| if [ -d "$VERSIONED_DEST_PATH" ]; then | |
| for version_dir in "$VERSIONED_DEST_PATH"/version-*; do | |
| if [ -d "$version_dir" ]; then | |
| experiments_api_dir="$version_dir/experiments-api" | |
| echo "Syncing to $experiments_api_dir" | |
| mkdir -p "$experiments_api_dir" | |
| rsync -av --delete --exclude='.git/' "$SOURCE_PATH/" "$experiments_api_dir/" | |
| fi | |
| done | |
| else | |
| echo "No versioned docs directory found at $VERSIONED_DEST_PATH" | |
| fi | |
| - name: Show Git Status | |
| run: | | |
| cd docs-website | |
| echo "=== Git Status ===" | |
| git status --porcelain | |
| echo "" | |
| echo "=== Detailed Git Status ===" | |
| git status | |
| echo "" | |
| echo "=== Files Changed ===" | |
| git diff --name-status | |
| echo "" | |
| echo "=== Diff Summary ===" | |
| git diff --stat | |
| # - name: Create Pull Request | |
| # uses: peter-evans/create-pull-request@v7 | |
| # env: | |
| # INTEGRATION_NAME: ${{ needs.generate-api-reference.outputs.integration_name }} | |
| # with: | |
| # token: ${{ secrets.HAYSTACK_BOT_TOKEN }} | |
| # commit-message: "Sync Core Integrations API reference (${{ env.INTEGRATION_NAME }}) on Docusaurus" | |
| # branch: sync-docusaurus-api-reference-${{ env.INTEGRATION_NAME }} | |
| # base: main | |
| # title: "docs: sync Core Integrations API reference (${{ env.INTEGRATION_NAME }}) on Docusaurus" | |
| # add-paths: | | |
| # docs-website | |
| # body: | | |
| # This PR syncs the Core Integrations API reference (${{ env.INTEGRATION_NAME }}) on Docusaurus. Just approve and merge it. |