mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
4a85559219
* always install pnpm * clean upo
79 lines
3.1 KiB
YAML
79 lines
3.1 KiB
YAML
# safe runs from main
|
|
|
|
name: publish
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
CI: true
|
|
PNPM_CACHE_FOLDER: .pnpm-store
|
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
|
jobs:
|
|
version_or_publish:
|
|
runs-on: ubuntu-22.04
|
|
environment: publish
|
|
steps:
|
|
- name: checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: install dependencies
|
|
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
|
|
with:
|
|
skip_build: "false"
|
|
- name: Build packages
|
|
run: |
|
|
. venv/bin/activate
|
|
pip install -U build hatch packaging>=23.2 # packaging>=23.2 is needed to build Lite due to https://github.com/pypa/hatch/issues/1381
|
|
pnpm --filter @gradio/client --filter @gradio/lite --filter @gradio/preview build
|
|
|
|
- name: create and publish versions
|
|
id: changesets
|
|
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # @v1
|
|
with:
|
|
version: pnpm ci:version
|
|
commit: "chore: update versions"
|
|
title: "chore: update versions"
|
|
publish: pnpm ci:publish
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
|
- name: add label to skip chromatic build
|
|
if: ${{ steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.pullRequestNumber != 'undefined' }}
|
|
run: gh pr edit "$PR_NUMBER" --add-label "no-visual-update"
|
|
env:
|
|
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
|
- name: add label to run flaky tests
|
|
if: ${{ steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.pullRequestNumber != 'undefined' }}
|
|
run: gh pr edit "$PR_NUMBER" --add-label "flaky-tests"
|
|
env:
|
|
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
|
- name: add label to run backend tests on Windows
|
|
if: ${{ steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.pullRequestNumber != 'undefined' }}
|
|
run: gh pr edit "$PR_NUMBER" --add-label "windows-tests"
|
|
env:
|
|
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
|
- name: publish to pypi
|
|
if: steps.changesets.outputs.hasChangesets != 'true'
|
|
uses: "gradio-app/github/actions/publish-pypi@main"
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.SDK_AWS_S3_BUCKET_ACCESS_KEY }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.SDK_AWS_S3_BUCKET_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: us-west-2
|
|
with:
|
|
user: __token__
|
|
passwords: |
|
|
gradio:${{ secrets.PYPI_API_TOKEN }}
|
|
gradio_client:${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }}
|
|
- name: trigger spaces deploy workflow
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.COMMENT_TOKEN }}
|
|
run: gh workflow run previews-build.yml
|