Sharing of secrets based on env ( dev, staging, prod)

My requirement is to share credentials based on env.

Environments

Dev

  • userName: XYZ
  • password: 1234

Staging

  • userName: ABC
  • password: 0998

now the job and its steps are for both the env but since the secret key is the same. How can I assign/use different key values in GitHub org secrets?

Proof of concept

Since circle ci provide this feature called context. Where you can create context i.e. prod, dev, staging, and then on can add the same keys and its respective value as per env.


@h2grover,

You can try to use the “Create or update an organization secret” API to update the value of the secret according to different environments.