Regex in environment variables



I want to set a variable in a build job that will be used in a the hugo command to set the baseurl. The branch is “docdock-baseurl”, so I want the hugo command to end with “docdock”. So far I have tried:

  • ${CIRCLE_BRANCH}/-baseurl/
  • ${CIRCLE_BRANCH/-baseurl/}
  • (${CIRCLE_BRANCH} | sed “s/-baseurl//”)
  • ({CIRCLE_BRANCH} | sed “s/-baseurl//”)

You can probably tell I’m shooting in the dark, but I also don’t see anything on the docs or otherwise that talks about regex in variables.

Here’s my config:

        - image: jmminy/alpine-hugo-git-bash:latest
    working_directory: ~/project
        VERSION: ${CIRCLE_BRANCH}/-baseurl/
        - checkout
        - run:
            name: Building site
            command: hugo -v --baseURL${VERSION}



After more digging, I found:

It says there that environment parameters are literal. The workaround is to add an export in the same run action:
- run:
command: |
export PATH=/go/bin:$PATH

I’ll see about adding something to the docs.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.