After a long search, I found a solution that I am posting here for anyone interested in creating a Git / Gerrit hook to do such a thing as me:
First, open http://example.com/rest/api/2/issue/<ISSUE>/transitions?expand=transitions.fields in your browser for your site and release number to find the transition ID.
Suppose 1000:
import urllib import urllib2 import base64 import json key = 'JIRA-123' comment = "It done!" username = 'username' password = 'password'
You can completely omit the comment section if you do not want to add a comment.
source share