gradio/.github/workflows/publish-npm.yml
Ali Abdalla 0be1e51f4f
Prevent race conditions when deploying website demos (#5480)
* wait for deploy to pypi

* read correct version for main deploys

* fixes

* rework

* use workflow dispatch

* fix build-pr
2023-09-18 12:47:04 -07:00

61 lines
1.9 KiB
YAML

name: Changesets
on:
push:
branches:
- main
- v4
env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
version_or_publish:
runs-on: ubuntu-22.04
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: install dependencies
uses: "./.github/actions/install-all-deps"
with:
always-install-pnpm: true
node_auth_token: ${{ secrets.NPM_TOKEN }}
npm_token: ${{ secrets.NPM_TOKEN }}
skip_build: 'true'
- name: Build packages
run: |
. venv/bin/activate
pip install build
pnpm css
pnpm --filter @gradio/client --filter @gradio/lite build
- name: create and publish versions
id: changesets
uses: changesets/action@v1
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "chore: update versions"
publish: pnpm ci:publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
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.AWSACCESSKEYID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWSSECRETKEY }}
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 build-pr.yml