Skip to content

Instantly share code, notes, and snippets.

@chinhnguyen
Last active December 29, 2019 15:17
Show Gist options
  • Save chinhnguyen/2a232e4b319526a4ef533ddccdea8d57 to your computer and use it in GitHub Desktop.
Save chinhnguyen/2a232e4b319526a4ef533ddccdea8d57 to your computer and use it in GitHub Desktop.
Programmatically create a version/release on JIRA upon creation of a SemVer tag on git
image: node:12
create_jira_version:
stage: post-deploy
only:
- tags
- /^(\d+\.)?(\d+\.)?(\*|\d+)$/
variables:
VERSION: $CI_BUILD_TAG
USER: $JIRA_USER:$JIRA_TOKEN
script: >-
curl --request POST
--url 'https://<yourdomain>.atlassian.net/rest/api/3/version'
--user $USER
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--data '{"name": "'"$VERSION"'", "projectId": <your project id>}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment