I have drone (0.8.5) successfully responding to GitHub events on our repos, and am trying to understand the “expected” pattern that Drone wants with regards to tagging, deployment, etc. Currently, when a PR is merged to master we’re doing the following in our .drone.yml
:
bump-version:
when:
event: [ push ]
image: node:8.11.1
commands:
- "npm --unsafe-perm version patch -m 'version bump: %s [ci skip]'"
- git push --follow-tags --set-upstream origin master
gcr:
when:
event: [ tag ]
image: plugins/gcr
registry: us.gcr.io
secrets: [ google_credentials ]
repo: OUR-GCR/OUR-SERVICE
auto_tag: true
The [ci skip]
in the comment (for the commit created by npm version
) is needed to ensure that the push of the version update doesn’t trigger another build and version bump. The problem is that this means that the webhook for the tag event also has the [ci skip]
comment, and thus gets ignored. We could do the GCR publish on the push
event as well, but then auto_tag: true
only tags the image with latest
, and not with the version numbers.
Are we going about things the wrong way? To me, npm version
is the way you are supposed to update a package’s version number, and doing this via CI/CD after a PR is merged to master is the appropriate time to bump the version if you want it to be automated. Is there some other way to ensure that the commit from the git push
won’t cause a subsequent build, but the tag from the push will? Alternatively, is there a way to allow the GCR (a.k.a. drone-docker) plugin to make use of the tags on the push
event instead of only on the tag
event?