Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing Env Variables from GitHub action to json

I want to pass the env variable from GitHub Action to my config.json file, How to pass the env variables to json file.

In GitHub action secret, I have set Node_Server_Url one of my IP address.

Config.json

{
  "SERVER_URL": "https://{ip}:9000",
}

like image 808
naga Avatar asked Dec 21 '25 21:12

naga


1 Answers

You could edit your config json files adding this step:

  - name: "inject server ip"
    env:
      server_ip: ${{ secrets.Node_Server_Url }}
    run: |
      sed -i "s/{ip}/$server_ip/g" config.json
like image 60
Matteo Avatar answered Dec 24 '25 11:12

Matteo