I use Github Actions workflows for my CI/CD processes for Node and PHP projects.
Within a workflow I clone my repository into Github Actions runner virtual machine. Then in order to run tests within a workflow I have to have the .env
file in the cloned repository.
The problem is my .env
file is not a part of repository (which is the ubuquitous practice).
To solve the problem I use what I consider a workaround: set up MY_PROJECT_ENV
Github Action sercret variable, manually put there the content of my .env
file and then dynamically create the .env
file within my workflow with Linux console echo "${{ secrets.MY_PROJECT_ENV}}" > .env
. This works.
But I would like to know are there other approaches for providing .env
files to Github Actions workflows?