I have a project where I have 4 environments (dev, test, staging and prod) and we have branches for each (develop, test, staging master respectively). We use npm version to bump version in package.json but also add a git tag. After that we run the build and on success of that, we push the commit and tag created by the npm version command. So in my pipeline job, I have this (simplified):
dev build: stage: build only: - develop@username/reponame script: - npm version patch -m "[ci skip] %s" - git add -A - echo "Do build here before pushing the version bump" - git push git@my-repo-url:$CI_PROJECT_PATH.git HEAD:develop --follow-tags
Notice with the npm version, I also specify a message for the git commit so I can add the “[ci skip]” which is how we stop the infinite loop but then we have pipeline runs listed as skipped under the status column. Not the worst thing in the world but wanted to see if there is a better way to do this sort of thing? Have a version git commit and tag pushed to the repo without triggering another pipeline run.