Skip to content

Commit

Permalink
ci: fix env
Browse files Browse the repository at this point in the history
  • Loading branch information
qinsong77 committed Sep 14, 2024
1 parent 1c8b277 commit 95adadd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
env:
REACT_APP_PUBLIC_PATH: /webpack5-react-template/
REACT_APP_MSW_ENABLE: true
REACT_APP_API_BASE_URL: /
REACT_APP_ENV: prod

steps:
- name: Checkout
Expand All @@ -24,7 +26,9 @@ jobs:
node-version: 20

- name: Set Environment Variables
run: echo "REACT_APP_PUBLIC_PATH=${{ env.REACT_APP_PUBLIC_PATH }}" >> $GITHUB_ENV
run:
echo "REACT_APP_PUBLIC_PATH=${{ env.REACT_APP_PUBLIC_PATH }}" >>
$GITHUB_ENV

- uses: pnpm/action-setup@v2
name: Install pnpm
Expand All @@ -48,8 +52,8 @@ jobs:
- name: Install dependencies
run: pnpm install

# - name: Run Tests
# run: pnpm run test --onlyChanged
# - name: Run Tests
# run: pnpm run test --onlyChanged

- name: Build
run: pnpm run build
Expand Down
1 change: 1 addition & 0 deletions webpack/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const config: Configuration = {
// basic: false, // 默认true,启用一个简单的日志报告器
// profile: false, // 默认false,启用探查器。
}),
// todo, 如果使用的某一个process.env.REACT_APP_XX,没有配置,则不会替换,会报错的
new DefinePlugin(
Object.keys(process.env)
.filter((key) => key.startsWith(ENV_PREFIX))
Expand Down

0 comments on commit 95adadd

Please sign in to comment.