name: GitHub Pages on: push: branches: - "**" release: types: [published] workflow_dispatch: jobs: deploy: runs-on: ubuntu-24.04 concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Install Pandoc # pin Pandoc version run: | cd /tmp wget https://github.com/jgm/pandoc/releases/download/2.19.2/pandoc-2.19.2-linux-amd64.tar.gz sudo tar xzvf pandoc-2.19.2-linux-amd64.tar.gz --strip-components 1 -C /usr/local - name: Setup Python uses: actions/setup-python@v6 with: python-version: "3.11" - name: Setup Node uses: actions/setup-node@v6 with: node-version: "22" - name: Install FFmpeg run: | sudo apt-get update sudo apt-get install -y ffmpeg - name: Upgrade pip run: python3 -m pip install --upgrade pip # Caching removed to resolve disk space issues # Heavy ML packages (TensorFlow, PyTorch, HuggingFace) will be downloaded fresh each run # but this avoids the 3.7GB cache that causes "No space left on device" errors - name: Install cleanlab run: pip install -e ".[all]" - name: Install dependencies run: python3 -m pip install -r docs/requirements.txt - name: Install katex run: npm install -g katex - name: Find and replace "%pip install cleanlab" with master branch in .ipynb files if: ${{ github.ref_type == 'branch' }} uses: jacobtomlinson/gha-find-replace@v2 with: find: "%pip install cleanlab ${{ '#' }} for colab" replace: "%pip install git+https://github.com/${{ github.repository }}.git@${{ github.sha }}" include: "docs/source**.ipynb" - name: Find and replace "%pip install cleanlab" with release tag in .ipynb files if: ${{ github.ref_type == 'tag' }} uses: jacobtomlinson/gha-find-replace@v2 with: find: "%pip install cleanlab ${{ '#' }} for colab" replace: "%pip install cleanlab==${{ github.ref_name }}" include: "docs/source**.ipynb" - name: Add and Commit changes to .ipynb files run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" git add -A && git commit -m "Change cleanlab ver in .ipynb files" - name: Change tag to the latest commit if: ${{ github.ref_type == 'tag' }} run: | git tag -f $GITHUB_REF_NAME - name: Run Sphinx with sphinx-multiversion wrapper - branch trigger if: ${{ github.ref_type == 'branch' }} env: TF_CPP_MIN_LOG_LEVEL: 3 HF_HOME: /tmp/hf_cache HF_HUB_DISABLE_SYMLINKS_WARNING: 1 TRANSFORMERS_CACHE: /tmp/transformers TORCH_HOME: /tmp/torch run: sphinx-multiversion docs/source cleanlab-docs -D smv_branch_whitelist=${{ github.ref_name }} -D smv_tag_whitelist=None - name: Run Sphinx with sphinx-multiversion wrapper - tag trigger if: ${{ github.ref_type == 'tag' }} env: TF_CPP_MIN_LOG_LEVEL: 3 HF_HOME: /tmp/hf_cache HF_HUB_DISABLE_SYMLINKS_WARNING: 1 TRANSFORMERS_CACHE: /tmp/transformers TORCH_HOME: /tmp/torch run: sphinx-multiversion docs/source cleanlab-docs -D smv_branch_whitelist=None -D smv_tag_whitelist=${{ github.ref_name }} - name: Debug temporary cache usage (not saved) run: | echo "=== Temporary Cache Usage ===" echo "These caches are created in /tmp and cleaned up after build:" echo " /tmp/hf_cache: $(du -sh /tmp/hf_cache 2>/dev/null | cut -f1 || echo 'not found')" echo " /tmp/transformers: $(du -sh /tmp/transformers 2>/dev/null | cut -f1 || echo 'not found')" echo " /tmp/torch: $(du -sh /tmp/torch 2>/dev/null | cut -f1 || echo 'not found')" echo "Pip cache directory: $(pip cache dir)" echo "Pip cache size: $(du -sh $(pip cache dir) 2>/dev/null | cut -f1 || echo 'not found')" echo "========================" - name: Get latest stable release id: stable_release continue-on-error: true uses: pozetroninc/github-action-get-latest-release@master with: owner: ${{ github.repository_owner }} repo: cleanlab excludes: prerelease, draft - name: Create latest_release.txt file if: ${{ steps.stable_release.outcome == 'success' }} run: echo ${{ steps.stable_release.outputs.release }} > cleanlab-docs/latest_release.txt - name: Find and replace "placeholder_version_number" in versioning.js if: ${{ steps.stable_release.outcome == 'success' }} uses: jacobtomlinson/gha-find-replace@v2 with: find: "placeholder_version_number" replace: ${{ steps.stable_release.outputs.release }} include: "docs/source/_templates/versioning.js" - name: Find and replace "placeholder_commit_hash" in versioning.js uses: jacobtomlinson/gha-find-replace@v2 with: find: "placeholder_commit_hash" replace: ${{ github.sha }} include: "docs/source/_templates/versioning.js" - name: Copy versioning JS file to cleanlab-docs/ run: | cp docs/source/_templates/versioning.js cleanlab-docs/versioning.js - name: Find and replace "stable_url" in redirect-to-stable.html if: ${{ github.ref_type == 'tag' && steps.stable_release.outcome == 'success' }} uses: jacobtomlinson/gha-find-replace@v2 with: find: "stable_url" replace: ${{ env.DOCS_SITE_URL }}stable/index.html include: "docs/source/_templates/redirect-to-stable.html" - name: Copy redirecting HTML file to cleanlab-docs/ if: ${{ github.ref_type == 'tag' }} run: cp docs/source/_templates/redirect-to-stable.html cleanlab-docs/index.html - name: Update OpenGraph URLs in HTML files # This code fixes the URLs in the HTML files with OpenGraph tags. # It uses a regular expression to capture two parts of the URL: # $1: The first part of the URL, including the protocol and domain. # $2: The rest of the URL, including the path and query string. # The replacement string combines the captured parts with the ref name. # This ensures that the ref name is inserted into the URL correctly. env: REF_URL_SEGMENT: ${{ (github.ref_type == 'tag' && steps.stable_release.outcome == 'success') && 'stable' || github.ref_name }} uses: jacobtomlinson/gha-find-replace@v2 with: find: '(