from my docker-compose file I have to read an env variable. locally, I can read that variable like this: ENV_FILE=.env docker-compose -f docker-compose.dev.prisma.yml up --build
but as .env file is in .gitignore, GitHub action can't get that file. how can I read them?
almost same issue in my package.json file. I have need some env variables to be read from npm scripts:
"start:backend": "wait-port $API_HOST:API_PORT && yarn start"
what I have tried is added those variables in secrets of github, but it didn't get those variables. though expect those 2 files, envs are read perfectly from github action.
Try creating your env file manually as a step in your workflow and pass in your repository secrets. Your docker-compose and package.json should be able to read your environment variables:
- name: create env file
run: |
touch .env
echo VARIABLE=${{ secrets.VARIABLE }} >> .env
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With