File size: 3,010 Bytes
a03b3ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Changesets
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
    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 --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: 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.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