【问题标题】:Github Actions Create .env fileGithub Actions 创建 .env 文件
【发布时间】:2021-02-18 04:15:29
【问题描述】:

我正在尝试使用SpicyPizza/create-envfile@v1 创建一个.env 文件作为Github Action 工作流程的一部分,下面是我的workflow 文件示例。

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: "10.x"
      - name: Install npm dependencies
        run: npm install
      - name: Create the .env file
        uses: SpicyPizza/create-envfile@v1
        with:
          envkey_QUERY_LIMIT: 20
          envkey_GOOGLE_RECAPTCHA_SECRET_KEY: ${{ secrets.GOOGLE_RECAPTCHA_SECRET_KEY }}
          file_name: .env
      - name: Run build task
        run: npm run build

构建作业成功,但部署后我的应用无法读取.env。任何想法为什么?

【问题讨论】:

  • 你的目标是什么?

标签: github-actions dotenv


【解决方案1】:

尝试添加目录。

steps:
    - name: Make envfile
      uses: SpicyPizza/create-envfile@v1
      with:
        envkey_DEBUG: false
        envkey_SOME_API_KEY: "123456abcdef"
        envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }}
        some_other_variable: foobar
        directory: <directory_name>
        file_name: .env

请参考here

【讨论】:

    猜你喜欢
    • 2021-10-30
    • 2021-05-20
    • 2020-05-27
    • 2021-09-23
    • 2021-05-23
    • 2020-09-15
    • 2021-10-23
    • 2021-02-12
    • 2022-01-07
    相关资源
    最近更新 更多