如何在Bitbucket管道上运行环境变量?

我已经了解了使用Bitbucket的管道,我想创建一个新的管道来上传我的React应用程序(由create-react-app引导)并上传到Amazon S3存储桶。

我制作了一个bitbucket-pipelines.yml的文件

image: node:10.15.3

pipelines:
  default:
    - step:
        name: Installing dependencies
        caches:
          - node
        script: # Modify the commands below to build your repository.
          - rm -rf package-lock.json
          - rm -f node_modules
          - yarn add
    - step:
        name: Build
        script:
          - yarn build

当Bitbucket运行它时,它会显示下一条错误消息

env-cmd -f .env.production.local react-scripts build
Error: Unable to locate env file at location (.env.production.local)

这是因为在package.json中,我使用env-cmd来读取构建脚本的环境变量。

  "scripts": {
    "start": "env-cmd -f .env.development.local react-scripts start","build": "env-cmd -f .env.production.local react-scripts build","test": "react-scripts test","eject": "react-scripts eject"
  },

但是我不知道如何在我的bitbucket-pipelines.yml文件中读取环境变量(位于.env文件内部)

我该怎么办?

wwwliuscom1 回答:如何在Bitbucket管道上运行环境变量?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3157339.html

大家都在问