2024-02-01 08:46:55 +08:00
|
|
|
name: publish
|
2023-03-22 21:46:23 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-06-29 22:41:26 +08:00
|
|
|
|
2023-03-22 21:46:23 +08:00
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
PNPM_CACHE_FOLDER: .pnpm-store
|
2023-06-29 22:41:26 +08:00
|
|
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
2023-03-22 21:46:23 +08:00
|
|
|
jobs:
|
2023-07-22 02:13:21 +08:00
|
|
|
version_or_publish:
|
|
|
|
runs-on: ubuntu-22.04
|
2023-03-22 21:46:23 +08:00
|
|
|
steps:
|
2023-07-22 02:13:21 +08:00
|
|
|
- name: checkout repo
|
2024-02-02 02:14:41 +08:00
|
|
|
uses: actions/checkout@v4
|
2023-03-22 21:46:23 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-05-13 04:22:41 +08:00
|
|
|
persist-credentials: false
|
2023-03-22 21:46:23 +08:00
|
|
|
- name: install dependencies
|
2024-02-01 18:34:22 +08:00
|
|
|
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
|
2023-06-29 21:07:14 +08:00
|
|
|
with:
|
2024-02-01 08:46:55 +08:00
|
|
|
always_install_pnpm: true
|
2024-04-26 20:38:53 +08:00
|
|
|
skip_build: 'false'
|
2023-04-03 21:33:01 +08:00
|
|
|
- name: Build packages
|
2024-04-30 11:18:13 +08:00
|
|
|
run: |
|
2024-01-11 07:22:22 +08:00
|
|
|
. venv/bin/activate
|
2024-04-30 11:18:13 +08:00
|
|
|
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
|
2024-04-26 21:53:21 +08:00
|
|
|
pnpm --filter @gradio/client --filter @gradio/lite --filter @gradio/preview build
|
2023-03-22 21:46:23 +08:00
|
|
|
- name: create and publish versions
|
2023-05-14 21:14:44 +08:00
|
|
|
id: changesets
|
2023-03-22 21:46:23 +08:00
|
|
|
uses: changesets/action@v1
|
|
|
|
with:
|
2023-05-13 03:21:58 +08:00
|
|
|
version: pnpm ci:version
|
2023-03-22 21:46:23 +08:00
|
|
|
commit: "chore: update versions"
|
|
|
|
title: "chore: update versions"
|
2023-03-22 22:42:58 +08:00
|
|
|
publish: pnpm ci:publish
|
2023-03-22 21:46:23 +08:00
|
|
|
env:
|
2023-03-23 01:53:35 +08:00
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2023-05-17 06:21:40 +08:00
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2023-05-14 21:14:44 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
2023-10-03 20:18:21 +08:00
|
|
|
- name: add label to skip chromatic build
|
|
|
|
if: ${{ steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.pullRequestNumber != 'undefined' }}
|
2024-04-30 11:18:13 +08:00
|
|
|
run: gh pr edit "$PR_NUMBER" --add-label "no-visual-update"
|
2023-10-03 20:18:21 +08:00
|
|
|
env:
|
|
|
|
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
|
2024-04-30 11:18:13 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
2024-01-18 23:33:32 +08:00
|
|
|
- name: add label to run flaky tests
|
|
|
|
if: ${{ steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.pullRequestNumber != 'undefined' }}
|
2024-04-30 11:18:13 +08:00
|
|
|
run: gh pr edit "$PR_NUMBER" --add-label "flaky-tests"
|
2024-01-18 23:33:32 +08:00
|
|
|
env:
|
|
|
|
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
|
2024-04-30 11:18:13 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
2023-11-12 07:10:03 +08:00
|
|
|
- name: add label to run backend tests on Windows
|
|
|
|
if: ${{ steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.pullRequestNumber != 'undefined' }}
|
2024-04-30 11:18:13 +08:00
|
|
|
run: gh pr edit "$PR_NUMBER" --add-label "windows-tests"
|
2023-11-12 07:10:03 +08:00
|
|
|
env:
|
|
|
|
PR_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }}
|
2024-04-30 11:18:13 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GRADIO_PAT }}
|
2023-07-22 02:13:21 +08:00
|
|
|
- name: publish to pypi
|
|
|
|
if: steps.changesets.outputs.hasChangesets != 'true'
|
|
|
|
uses: "gradio-app/github/actions/publish-pypi@main"
|
2024-04-30 11:18:13 +08:00
|
|
|
env:
|
2023-08-25 03:03:06 +08:00
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWSACCESSKEYID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWSSECRETKEY }}
|
|
|
|
AWS_DEFAULT_REGION: us-west-2
|
2023-07-22 02:13:21 +08:00
|
|
|
with:
|
|
|
|
user: __token__
|
|
|
|
passwords: |
|
2023-08-25 03:25:41 +08:00
|
|
|
gradio:${{ secrets.PYPI_API_TOKEN }}
|
2023-09-19 03:47:04 +08:00
|
|
|
gradio_client:${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }}
|
|
|
|
- name: trigger spaces deploy workflow
|
2024-04-30 11:18:13 +08:00
|
|
|
env:
|
2023-09-19 03:47:04 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.COMMENT_TOKEN }}
|
2024-02-02 04:09:01 +08:00
|
|
|
run: gh workflow run deploy-spaces.yml
|