Skip to content

Instantly share code, notes, and snippets.

What would you like to do?


Create a release on JIRA using the version number from package.json


Create env variables JIRA_HOST (the hostname of your JIRA installation, which needs the REST API enabled), JIRA_PROJECT (the id of the project you want to create releases in, which should be a short alphabetic string), and JIRA_USERNAME & JIRA_PASSWORD (these should be for a user that has at least Project Admin permissions on the project). Run:


If SOURCE_VERSION is set (i.e. it's running on Heroku), it'll be mentioned in the release description.

It's handy to run this with npm lifecycle scripts. You might consider postinstall, postpublish or heroku-postbuild.



#!/usr/bin/env node
import logPromise from '@quarterto/log-promise';
import assertEnv from '@quarterto/assert-env';
import jiraCreateVersion from '@quarterto/jira-create-version';
import path from 'path';
const commit = process.env.SOURCE_VERSION;
const packagePath = path.resolve('package.json');
const {version, name} = require(packagePath);
if(process.env.JIRA_HOST) {
`created version ${version} on JIRA`,
e => e.stack
)(jiraCreateVersion(`${name}-${version}`, {
description: `Release ${commit} to Heroku`,
hostname: process.env.JIRA_HOST,
project: process.env.JIRA_PROJECT,
user: process.env.JIRA_USERNAME,
pass: process.env.JIRA_PASSWORD,
})).catch(() => process.exit(1));
} else {
console.log(`⤼ No JIRA host, not creating release ${version}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.