File size: 1,550 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
name: 'install frontend'
description: 'Install frontend deps'

inputs:
  always-install-pnpm:
    description: 'Dictates whether or not we should install pnpm & dependencies, regardless of the cache'
    default: 'false'
  node_auth_token:
    description: 'Node auth token'
    default: ""
  npm_token:
    description: 'npm token'
    default: ""
  skip_build:
    description: 'Skip build'
    default: 'false'

runs:
  using: "composite"
  steps:
    - uses: actions/cache@v4
      id: frontend-cache
      with:
        path: |
          gradio/templates/*
        key: gradio-lib-front-end-${{ hashFiles('js/**', 'client/js/**')}}
    - name: Install pnpm
      if: steps.frontend-cache.outputs.cache-hit != 'true' || inputs.always-install-pnpm == 'true'
      uses: pnpm/action-setup@v2
      with:
        version: 8.9
    - uses: actions/setup-node@v4
      with:
        node-version: 18
        cache: pnpm
        cache-dependency-path: pnpm-lock.yaml
      env:
          NODE_AUTH_TOKEN: ${{ inputs.always-install-pnpm }}
          NPM_TOKEN: ${{ inputs.always-install-pnpm }}
    - name: Install deps
      if: steps.frontend-cache.outputs.cache-hit != 'true' || inputs.always-install-pnpm == 'true'
      shell: bash
      run: pnpm i --frozen-lockfile --ignore-scripts
    - name: Build Css
      if: inputs.always-install-pnpm == 'true'
      shell: bash
      run: pnpm css
    - name: Build frontend
      if: inputs.skip_build == 'false' && steps.frontend-cache.outputs.cache-hit != 'true'
      shell: bash
      run: pnpm build