From 4e70702a6d30691065ee3bd13b4da4340bdde2ab Mon Sep 17 00:00:00 2001 From: notend Date: Thu, 4 Jan 2024 20:39:31 +0800 Subject: [PATCH] ci: add PUBLIC_PATH to env --- .github/workflows/build.yml | 6 ++++++ webpack/config.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7cef3e7..722b17e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,9 @@ jobs: cache-and-install: runs-on: ubuntu-latest + env: + PUBLIC_PATH: webpack5-react-template + steps: - name: Checkout uses: actions/checkout@v3 @@ -19,6 +22,9 @@ jobs: with: node-version: 18 + - name: Set Environment Variables + run: echo "PUBLIC_PATH=${{ env.PUBLIC_PATH }}" >> $GITHUB_ENV + - uses: pnpm/action-setup@v2 name: Install pnpm with: diff --git a/webpack/config.ts b/webpack/config.ts index 61014b2..aa4fdd8 100644 --- a/webpack/config.ts +++ b/webpack/config.ts @@ -15,7 +15,7 @@ loadConfig({ path: ENV_CONFIG_PATH, }) -export const PUBLIC_PATH = '/' +export const PUBLIC_PATH = process.env.PUBLIC_PATH ?? '/' // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore