diff --git a/.github/actions/install-all-deps/action.yml b/.github/actions/install-all-deps/action.yml index 6e45bf6ae8..407fb28fd9 100644 --- a/.github/actions/install-all-deps/action.yml +++ b/.github/actions/install-all-deps/action.yml @@ -5,6 +5,15 @@ 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" @@ -40,3 +49,6 @@ runs: uses: "./.github/actions/install-frontend-deps" with: always-install-pnpm: ${{ inputs.always-install-pnpm }} + node_auth_token: ${{ inputs.node_auth_token }} + npm_token: ${{ inputs.npm_token }} + skip_build: ${{ inputs.skip_build }} diff --git a/.github/actions/install-frontend-deps/action.yml b/.github/actions/install-frontend-deps/action.yml index cd4f7af63a..a0c8664091 100644 --- a/.github/actions/install-frontend-deps/action.yml +++ b/.github/actions/install-frontend-deps/action.yml @@ -5,6 +5,15 @@ 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" @@ -25,11 +34,14 @@ runs: 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 - name: Build frontend - if: steps.frontend-cache.outputs.cache-hit != 'true' + if: inputs.skip_build == 'false' && steps.frontend-cache.outputs.cache-hit != 'true' shell: bash run: pnpm build \ No newline at end of file diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 13cc105820..ccdb7843e5 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -15,21 +15,13 @@ jobs: with: fetch-depth: 0 persist-credentials: false - - name: Setup pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - name: setup node.js - uses: actions/setup-node@v3 - with: - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - node-version: 18 - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: install dependencies - run: pnpm install --frozen-lockfile + 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: pnpm --filter @gradio/client --filter @gradio/lite build - name: create and publish versions diff --git a/js/app/package.json b/js/app/package.json index b831549855..5347031609 100644 --- a/js/app/package.json +++ b/js/app/package.json @@ -9,8 +9,8 @@ "build:cdn": "vite build --mode production:cdn --emptyOutDir", "build:website": "vite build --mode production:website --emptyOutDir", "build:local": "vite build --mode production:local --emptyOutDir", - "pybuild:gradio": "cd ../../ && rm -rf gradio/templates/frontend && python3 -m build", - "pybuild:gradio-client": "cd ../../client/python && python3 -m build", + "pybuild:gradio": "cd ../../ && rm -rf gradio/templates/frontend && python -m build", + "pybuild:gradio-client": "cd ../../client/python && python -m build", "pybuild": "run-p pybuild:*", "build:lite": "pnpm pybuild && vite build --mode production:lite --emptyOutDir", "preview": "vite preview",