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 |