-
Notifications
You must be signed in to change notification settings - Fork 7
Integrate with CircleCI
Steven Thomas edited this page Mar 15, 2018
·
1 revision
The most common use case for semantics
that we've had so far has involved integrating with CircleCI. This allows all master
builds in CircleCI to automatically create and push a new tag to GitHub.
Unfortunately, it's a little tricky getting everything set up properly. So here's a quick walkthrough:
- Create a deploy key for your GitHub repo. Ensure that it has read/write permissions.
- Import that deploy key into the CircleCI settings page for that repo. Set the hostname to
github.com
. -
If you're using CircleCI 2.0 you will also need change your
config.yml
file.- Add the command
add_ssh_keys
to the step that is responsible for executingsemantics
. Example.
- Add the command
Once you follow the steps above, you should have the necessary permissions to create tags in GitHub.
You're free to use semantics however you like, but here's a simple method that works well in CircleCI.
Just add the following bash commands in the deploy phase of your CircleCI 2.0 config:
go get -u github.com/stevenmatthewt/semantics
tag=$(semantics --output-tag) # This pushes to GitHub, and also captures the tag
if [ "$tag" ]; then
# You have the new tag, so you're free to do whatever you want with it.
# You can push it to NPM, DockerHub, Quay...
else
echo "The commit message(s) did not indicate a major/minor/patch version."
fi