DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

muckitymuck
muckitymuck

Posted on

Github Actions, env file creation, docker silliness

To push on a branch you want to target, make a workflow yml file and include:

on: 
  push:
    branches: [prod]
Enter fullscreen mode Exit fullscreen mode

You can add an env file to your build when you deploy via Github Actions and still protect the data in your Secrets.

First take your .env file and put in secrets with any name(here it is ENV_FILE).
Then add this to your workflow.yml in the build area:

      - name: Make envfile
        uses: SpicyPizza/create-envfile@v1
        with:
          envkey_DEBUG: false
          envkey_SECRET_KEY: ${{ secrets.ENV_FILE }}
          file_name: .env
Enter fullscreen mode Exit fullscreen mode

If in the course you get this error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/build?
Enter fullscreen mode Exit fullscreen mode

Try these:

sudo groupadd docker
sudo usermod -aG docker ${USER}
sudo chmod 666 /var/run/docker.sock
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

πŸ‘‹ Hey, my name is Noah and I’m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, I’d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: