Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate .env file in github actions #239

Open
naorye opened this issue Jan 31, 2023 · 1 comment
Open

generate .env file in github actions #239

naorye opened this issue Jan 31, 2023 · 1 comment

Comments

@naorye
Copy link

naorye commented Jan 31, 2023

I am trying to integrate dotenv with my deployment process.
I am using Github actions to build the app and as part of the build process I generate app.yaml file from app.yaml.template:

      - id: prepare-app-yaml
        uses: mshick/fast-envsubst@v1
        with:
          env-file: app/.env
          in-file: app/app.yaml.template
          out-file: app/app.yaml

The generation process required env vars. Before dotenv I used the following command to generate .env file:

      - id: generate-dotenv-file
        env:
          DOTENV_CONTENT: ${{ secrets.DOTENV_CONTENT }}
        run: echo "$DOTENV_CONTENT" > app/.env

Now I am trying to generate the .env file using dotenv but there is no way to do it using the DOTENV_KEY only. I don't want to add DOTENV_ME var because that way my CI will have both DOTENV_ME and DOTENV_KEY (which is used by the application runtime).
Its there a way to write .env file?

@nahueloyha
Copy link

It seems there is no official way yet, but you could use the local-decrypt command to fetch / generate your .env file:

npx dotenv-vault local decrypt $DOTENV_KEY > .env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants