I have a bitbucket repository. I have Deployment environment variables in bitbucket:
BITBUCKET_VARIABLE_PORT : 8080
In my bitbucket-pipelines.yaml
script I can Write the variable into the .env file like this:
<...>
step: &deploy-to-environment
name: Deploy to environment
deployment: environment
caches:
- node
script:
- echo Create .env file
- echo "PORT=$BITBUCKET_VARIABLE_PORT" > .env
- cat .env
<...>
But I would like to avoid rewriting the whole lines of .env file.
Is it possible to implement the following?
- I would like to have .env file with placeholders (.env file content):
<...>
PORT=<BITBUCKET_VARIABLE_PORT>
HOST=<BITBUCKET_VARIABLE_HOST>
<...>
- Replace these placeholders in yaml script section:
<...>
step: &deploy-to-environment
name: Deploy to environment
deployment: environment
caches:
- node
script:
- <replace_placeholders_here_in_script>
<...>