Variable substitution

I’ve worked with Octopus Deploy and Azure DevOps, where it’s straight forward to do variable substitution, but I find nothing about it for CircleCI. Googling “CircleCI variable substitution” gives no hints.

I basically want to do something like this Variable substitutions - Octopus Deploy, i.e. pinpoint a file that should be affected (a json file in my case) and change all properties that match any of the environment variables declared in Circle CI.

A concrete example:
In the json file that I want to modify, there is a property named mongodbURI.

In the config.yml file I’d like to do something like:

version: 2.1

orbs:
  heroku: circleci/heroku@1.2.6

jobs:
  stage:
    executor: heroku/default
    steps:
      - checkout
      - variable-substitution
        path: "config/*json"
        variables:
          - mongodbURI: $MONGODB_STAGING_URI
      - heroku/install
      - heroku/deploy-via-git:
          app-name: $HEROKU_STAGING_APP_NAME

...

Is this doable with CircleCI?

I’m somewhat new to circleci, so can not say for certain that there is no such built-in feature, but I have not yet come across such a feature in the docs and this old discussion exchange indicates that there was no built-in feature about 2 years ago.

The easiest way to emulate this would be to have a run step defined that just executes a shell script to do the same task.

Thanks for your reply.

This seems strange to me as variable substitution has been essential in the previous pipelines that I’ve built.

If the option is to implement it myself, I think I’ll go with Github Actions instead, that support variable substitution out of the box.