gradio/.github/actions/install-frontend-deps/action.yml
renovate[bot] 7c1baf954f
Update actions/setup-node action to v4 (#6269)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-11-20 23:48:36 -08:00

51 lines
1.5 KiB
YAML

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@v3
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