How to access GitHub tag value in a job?

Hi,
I’m trying to follow the steps here: https://circleci.com/blog/publishing-to-github-releases-via-circleci/#ci-builds-circleci-20-example to publish an artifact to github releases. However, this example get the $VERSION from the binary and I can’t do that. I want to set the version to be whatever the tag is from github. Is there a way to access the tag from Github that triggers the publish-github-release job?

Builds that are a part of a tag expose the CIRCLE_TAG environment variable. You can use this to get the version of the tag.

You can see this in practice here: https://github.com/levlaz/circleci.py/blob/master/setup.py#L22

This function will compare the tag version in circle with the “version” of the package. In my case they need to match in order to proceed.

1 Like

Thanks @levlaz. That worked.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.