Keeping package.json version intact during merge

I need to find a way to keep ‘version’ intact in package.json of the ‘dev’ branch after merging ‘feature’ branch into ‘dev’. I can’t figure out the best way to do it.
Can I do this just using .gitlab-ci.yml or a combination of bash script and gitlab yml. Note, ‘feature’ branch will always have differnt ‘version’ in package.json to the dev’s package.json.

I tried using bash and assigning a variable to package.json ‘version’, then after merge updating package.json with pre-merge version. Doesn’t seem like a good solution.