CircleCi runs when code is pushed to master, however CircleCi pushes to master itself in a run script called Version Package Bump. So after this first build, a second is run. But it fails with message:
On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean Exited with code 1
How do I make sure CircleCi doesn't initiate again from a push caused by itself?
jobs:
build:
docker:
- image: circleci/node:8.10.0
branches:
only:
- master
steps:
- add_ssh_keys
- checkout
- run:
name: Keyscan DreamHost (HACK)
command: ssh-keyscan -H HOST >> ~/.ssh/known_hosts
- run:
name: Install Dependencies
command: npm install
- run:
name: Build App
command: npm run build
- run:
name: Verion Package Bump
command: |
git config user.name "circleci"
git config user.email "EMAIL"
git add .
git commit -m "[ci] Generated Build"
npm version patch -m "[ci] Bumped version number to %s"
git push origin master
git push --tags
- deploy:
name: Publish to DreamHost
command: scp -r build/* HOST:./DIRECTORY/
Even if I wrap it in a conditional I still see that same error and a build happens twice:
if ! git diff-index --quiet HEAD --; then
git config user.name "circleci"
git config user.email "EMAIL"
git add .
git commit -m "[ci] Generated Build"
npm version patch -m "[ci] Bumped version number to %s"
git push origin master
git push --tags
fi
Add a [ci skip] or [skip ci] tag anywhere in a commit’s message.
See https://circleci.com/docs/2.0/skip-build/
Replace your
git commit -m "[ci] Generated Build"
with
git commit -m "[ci skip] Generated Build"
or
git commit -m "Generated Build [skip ci]"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With