2024-08-05 22:27:26 +08:00
|
|
|
name: "storybook-build"
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- 5.0-dev
|
|
|
|
|
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
|
|
|
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: "${{ github.event.pull_request.number }}-${{ github.ref_name }}-${{ github.workflow }}"
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2024-08-08 01:27:01 +08:00
|
|
|
permissions: {}
|
|
|
|
|
2024-08-05 22:27:26 +08:00
|
|
|
jobs:
|
|
|
|
changes:
|
2024-08-08 01:27:01 +08:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pull-requests: read
|
2024-08-05 22:27:26 +08:00
|
|
|
name: "changes"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
should_run: ${{ steps.changes.outputs.should_run }}
|
2024-08-06 06:47:45 +08:00
|
|
|
sha: ${{ steps.changes.outputs.sha }}
|
|
|
|
source_branch: ${{ steps.changes.outputs.source_branch }}
|
|
|
|
source_repo: ${{ steps.changes.outputs.source_repo }}
|
2024-08-05 22:27:26 +08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: "gradio-app/gradio/.github/actions/changes@main"
|
|
|
|
id: changes
|
|
|
|
with:
|
|
|
|
filter: "visual"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2024-08-06 18:54:11 +08:00
|
|
|
build:
|
2024-08-08 01:27:01 +08:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2024-08-06 18:54:11 +08:00
|
|
|
name: :storybook-build
|
2024-08-05 22:27:26 +08:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
needs: changes
|
|
|
|
if: needs.changes.outputs.should_run == 'true'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-08-06 06:47:45 +08:00
|
|
|
with:
|
|
|
|
ref: ${{ needs.changes.outputs.source_branch }}
|
|
|
|
repository: ${{ needs.changes.outputs.source_repo }}
|
2024-08-05 22:27:26 +08:00
|
|
|
- name: install dependencies
|
|
|
|
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
|
|
|
|
with:
|
|
|
|
skip_build: "true"
|
|
|
|
- name: build client
|
|
|
|
run: pnpm --filter @gradio/client build
|
|
|
|
- name: generate theme.css
|
|
|
|
run: |
|
|
|
|
. venv/bin/activate
|
|
|
|
python scripts/generate_theme.py --outfile js/storybook/theme.css
|
|
|
|
- name: build storybook
|
|
|
|
run: pnpm build-storybook --quiet
|
|
|
|
- name: upload storybook
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: storybook-static
|
|
|
|
path: storybook-static
|