Im using CircleCI for CI/CD and recently wanted to start tagging my releases to main bransch. This is my config.yml
version: 2.1
orbs:
node: circleci/node@1.1.6
jobs:
build:
executor:
name: node/default
steps:
- checkout
- node/with-cache:
steps:
- run: git pull
- run: npm install standard-version
- run: npm run release
- run: git push --follow-tags origin master
- node/with-cache:
steps:
- run: echo 'deploying master branch'
Ofcourse this triggers and endless loop since it creates a new push which triggers CircleCI... I've read that you can skip builds in commit messages by adding [ci skip] but pushing tags does not give that option.
How do I get around this? I want the semantic releases to be tagged automatically when a new version is released... Can I somehow get around this?
Im using standard-version for tagging and updating package.json.
Any help would be greatly appriciated
The solution was the following changes to my config.yml:
version: 2.1
orbs:
node: circleci/node@1.1.6
jobs:
build:
executor:
name: node/default
steps:
- checkout
- node/with-cache:
steps:
- checkout
- run: npm install
- run: npm run test
- run: npx semantic-release
- node/with-cache:
steps:
- run: echo 'deploying master branch'
- run: ssh -v -o "StrictHostKeyChecking no" user@xxxx.xxx "cd ~/projects/xxx; git pull --rebase; ./publish.sh"
workflows:
version: 2
build_project:
jobs:
- build:
filters:
branches:
only: master
When doing this with "- run: npx semantic-release", the version bumping step will be auto incremented and the commit tagged with [skip ci] so it doesnt loop.