我正在尝试将create-react-app部署到firebase主机上。
我遵循了入门指南中的步骤,并为我设置了github操作工作流。看起来是这样的:
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_xxxxx }}'
channelId: live
projectId: master
env:
FIREBASE_CLI_PREVIEWS: hostingchannels
CI: false
但是,当我推送新的提交时,构建会因为Treating warnings as errors because process.env.CI = true.
而失败
如你所见,我试图通过添加CI: false
来修复这个问题,但是CI
仍然被设置为true
。我该如何解决这个问题呢?为什么我解决这个问题的尝试不起作用?
发布于 2021-04-25 05:45:20
修复方法是将CI: false
移到build_and_deploy
步骤之上:
env:
CI: false
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_xxxxx }}'
channelId: live
projectId: xxxxxx
env:
FIREBASE_CLI_PREVIEWS: hostingchannels
为什么会有两个env
?不知道,但它是有效的。
https://stackoverflow.com/questions/67245541
复制相似问题