I'm working on a GitLab CI/CD pipeline where we merge the develop
branch into the main
branch. However, we've encountered an issue where the version numbers in the package.json
file are updated in the main
branch during the merge, but not in the develop
branch. This leads to a situation where, when merging develop
into main
again, the version numbers do not increment because the develop
branch still holds the old version, preventing a new version from being created.
Here's the relevant part of my .gitlab-ci.yml
file for publishing the NPM
packages:
.publish_npm_template:
stage: publish
script:
- |
ng build @Lib/${LIBRARY_DIRECTORY} --configuration=production
npm version patch
npm publish to registry
publish_npm_Lib:
extends: .publish_npm_template
variables:
LIBRARY_DIRECTORY: LibDIR
rules:
- if: $CI_COMMIT_BRANCH == "main"
How can I ensure that the version numbers are correctly updated in both branches during merges so that new versions are always generated in future pipeline runs?