<p>I'm using github actions for creating new images and pushing them to a registry.</p>
<pre><code>    - name: Build the Docker image
      run: docker build . --file Dockerfile  --tag ${{secrets.DOCKER_USER}}/book:$GITHUB_SHA
</code></pre>
<p>This works perfectly. Now, I need to replace the value of the image. So I thought of using yq</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - image: xxxxx/book:main
</code></pre>
<pre><code>    - name: Replace Image
      run: yq -i e '.spec.template.spec.containers.image |= ${{secrets.DOCKER_USER}}/guestbook:$GITHUB_SHA' argo/deployment.yaml
</code></pre>
<p>But getting this error <code>Error: 1:43: invalid input text &quot;xxxx/book:...&quot; Error: Process completed with exit code 1.</code></p>
<p>How I would need to do this replacement?</p>

Diego
<p>Use the correct json path expression to the <code>image</code> property and quote the replacement value.</p>
<p>Example:</p>
<pre><code>$ yq '.spec.template.spec.containers.[0].image = &quot;STRING&quot;' argo/deployment.yaml 
apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
        - image: STRING
$ yq --version
yq (https://github.com/mikefarah/yq/) version v4.34.1
</code></pre>
