Files
lancedb/.github/workflows/docs.yml
T
Xuanwo 2806709b75 fix(ci): hand off Pages artifact to a separate deploy job (#5236)
The docs workflow uploads `github-pages` and deploys in the same job. On
`0adfd22`, attempt 1 finished the upload and the deploy immediately
found zero artifacts; attempt 2 uploaded again and the deploy found two
artifacts with the same name. Four earlier main runs show the same
zero-artifact race.

This uploads the site as `github-pages-<run_id>-<run_attempt>`, exposes
that name as a `build` job output, and deploys from a separate `needs:
build` job using the same name. A full workflow re-run gets a fresh
name, while a deploy-only retry keeps the original build output and
reuses the artifact uploaded by that build.

The existing action pins already expose the required inputs (`name` on
`upload-pages-artifact`, `artifact_name` on `deploy-pages`), so this
does not bump actions. Workflow triggers, permissions, concurrency, docs
build steps, and the Pages environment URL are unchanged.

Validation: `actionlint .github/workflows/docs.yml`, YAML parsing, and
`git diff --check` pass locally. Hosted checks run on this PR; the
actual Pages upload and deploy are verified on main after merge because
the workflow only deploys from `main`.

Evidence:
- [attempt
1](https://github.com/lancedb/lancedb/actions/runs/45805006874/job/139857949931):
upload succeeded, deploy logged `Found 0 artifact(s)`.
- [attempt
2](https://github.com/lancedb/lancedb/actions/runs/45805006874/job/139875545904):
upload succeeded, deploy logged `Found 2 artifact(s)` and failed with
`Multiple artifacts named "github-pages" were unexpectedly found`.
- Earlier main runs with the same zero-artifact result:
[45724226049](https://github.com/lancedb/lancedb/actions/runs/45724226049),
[45706607284](https://github.com/lancedb/lancedb/actions/runs/45706607284),
[45700962558](https://github.com/lancedb/lancedb/actions/runs/45700962558),
[45687315855](https://github.com/lancedb/lancedb/actions/runs/45687315855).
2026-11-26 20:24:14 +08:00

94 lines
3.1 KiB
YAML

name: Deploy docs to Pages
on:
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
env:
# This reduces the disk space needed for the build
RUSTFLAGS: "-C debuginfo=0"
# according to: https://matklad.github.io/2021/09/04/fast-rust-builds.html
# CI builds are faster with incremental disabled.
CARGO_INCREMENTAL: "0"
PIP_EXTRA_INDEX_URL: "https://pypi.fury.io/lance-format/ https://pypi.fury.io/lancedb/"
jobs:
build:
runs-on: ubuntu-24.04
outputs:
artifact_name: ${{ steps.artifact-name.outputs.name }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies needed for ubuntu
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
rustup update && rustup default
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "docs/requirements.txt"
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- name: Build Python
working-directory: python
run: |
python -m pip install --extra-index-url https://pypi.fury.io/lance-format/ --extra-index-url https://pypi.fury.io/lancedb/ -e .
python -m pip install --extra-index-url https://pypi.fury.io/lance-format/ --extra-index-url https://pypi.fury.io/lancedb/ -r ../docs/requirements.txt
- name: Set up node
uses: actions/setup-node@v6
with:
node-version: 24
- name: Install node dependencies
working-directory: nodejs
run: |
sudo apt update
sudo apt install -y protobuf-compiler libssl-dev
- name: Build docs
working-directory: docs
run: |
PYTHONPATH=. mkdocs build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Set artifact name
id: artifact-name
run: echo "name=github-pages-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
name: ${{ steps.artifact-name.outputs.name }}
path: "docs/site"
# Deploy from a separate job so the Pages artifact upload has settled before
# the deploy action looks it up. The per-run name keeps a full workflow
# re-run from accumulating artifacts that share the default name.
deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: ${{ needs.build.outputs.artifact_name }}