Replace string in file during job not saving to artifacts


I have the following in my .gitlab-ci.yml file:

    stage: deploy
    - echo "Fixing package version"
    - sed -i "s/0.0.0+DEV/${CI_COMMIT_TAG}/g" package.json
    - tags

I would like to replace the 0.0.0+DEV characters with the commit tag name. When the runner runs it does this. However when I download the artifact it still has the 0.0.0+DEV. I’ve probably missed on how to accomplish this. I’m guessing the artifact comes directly from the commit and not what the runner does.

Is there a way to fix this?

Any new update? I’m stuck on this aswell

Hello, was trying your function, and faced error
sed: 1: “Assets/SDK/MySDK.cs”: invalid command code A

Added -e , and now everything working perfectly. Thank you.
$ sed -i -e “s/0.0.0/${VERSION}/g” Assets/SDK/MySDK.cs