title: How to replace a variable in yml file with a gitlab ci pipeline variable using sed
body: <p>I want to replace a variable in my .yml file with a variable from the gitlab ci pipeline.</p>
  
  <p><strong>gitlab-ci.yml</strong></p>
  
  <pre><code>deploy_test:
    stage: deploy
    script:
      - sed -i 's/$TAG/$CI_COMMIT_REF_NAME/g' deploy/test.yml
      - kubectl apply -f deploy/test.yml
    when: manual
    only:
      - master
      - tags
  </code></pre>
  
  <p>This says within the deploy/test.yml file it should replace $TAG with the value of $CI_COMMIT_REF_NAME?</p>
  
  <p><strong>deploy/test.yml</strong></p>
  
  <pre><code>image: git.&lt;removed&gt;.com:5005/eng/my-group/my-image:$TAG
  </code></pre>