This repository was archived by the owner on Jan 23, 2026. It is now read-only.
fix(ci): set node version to 20 #64
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: Build documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| paths: | |
| - 'docs/source/**' | |
| - 'docs/assets/**' | |
| - 'optimum/**' | |
| - '.github/workflows/doc-build.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build_documentation: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
| PR_NUMBER: ${{ github.event.number }} | |
| EVENT_CONTEXT: ${{ toJSON(github.event) }} | |
| PR_CLONE_URL: ${{ github.event.pull_request.head.repo.clone_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache-dependency-path: "kit/package-lock.json" | |
| - name: Set environment variables | |
| run: | | |
| cd optimum | |
| version=`echo "$(grep '^__version__ =' tpu/version.py | cut -d '=' -f 2- | xargs)"` | |
| if [[ $version == *.dev0 ]] | |
| then | |
| echo "VERSION=main" >> $GITHUB_ENV | |
| else | |
| echo "VERSION=v$version" >> $GITHUB_ENV | |
| fi | |
| cd .. | |
| - name: Setup environment | |
| run: | | |
| pip install -U pip | |
| pip install git+https://github.com/huggingface/doc-builder.git | |
| pip install ".[quality]" -f https://storage.googleapis.com/libtpu-releases/index.html | |
| - name: Make documentation | |
| shell: bash | |
| run: | | |
| doc-builder notebook-to-mdx examples/ --output_dir docs/source/howto/ --open_notebook_prefix https://colab.research.google.com/github/huggingface/optimum-tpu/blob/main | |
| python docs/scripts/auto-generate-examples.py | |
| doc-builder build optimum.tpu docs/source/ --repo_name optimum-tpu --build_dir tpu-doc-build/ --version ${{ env.VERSION }} --version_tag_suffix "" --html --clean | |
| cd tpu-doc-build/ | |
| mv optimum.tpu optimum-tpu | |
| doc-builder push optimum-tpu --doc_build_repo_id "hf-doc-build/doc-build" --token "${{ secrets.HF_DOC_BUILD_PUSH }}" --commit_msg "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/optimum-tpu/commit/$COMMIT_SHA" --n_retries 5 |