GitHub Integration

Jason Chayer
Contributor
October 4, 2024

With the GitHub integration, when we create a build in GitHub, can that also create a release in Jira? Currently, we have to create a build a release in both. Ideally, we would like to create the release/build in GitHUb, and that automatically creates the release in Jira.

1 answer

0 votes
Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 5, 2024

Hi @Jason Chayer 

To automate the creation of a release in Jira Cloud when a build is created in GitHub, you can use GitHub Actions along with the Jira Cloud REST API. Here’s a detailed guide on how to set this up:

 Steps to Integrate GitHub with Jira Cloud

1. **Create an API Token in Jira Cloud**:

   - Go to your Jira account settings.

   - Navigate to **Security** > **API token**.

   - Click on **Create API token**, give it a label, and copy the generated token.

 

2. **Store the API Token in GitHub Secrets**:

   - Go to your GitHub repository.

   - Navigate to **Settings** > **Secrets and variables** > **Actions**.

   - Click **New repository secret**.

   - Name it something like `JIRA_API_TOKEN` and paste the token.

 

3. **Create a GitHub Actions Workflow**:

   - Create a new file in your repository: `.github/workflows/create-jira-release.yml`.

   - Add the following content to the workflow file:

   name: Create Jira Release




   on:

     push:

       tags:

         - 'v*' # Adjust this to your versioning scheme




   jobs:

     create-release:

       runs-on: ubuntu-latest

       steps:

         - name: Create Release in Jira

           run: |

             curl -X POST \

               -H "Content-Type: application/json" \

               -H "Authorization: Basic $(echo -n 'your-email@example.com:${{ secrets.JIRA_API_TOKEN }}' | base64)" \

               --data '{

                 "name": "${{ github.ref }}",

                 "description": "Release created from GitHub build.",

                 "project": "YOUR_PROJECT_KEY",

                 "released": true

               }' \

               https://your-domain.atlassian.net/rest/api/3/version

   ```

 

   **Replace the placeholders**:

   - `your-email@example.com`: Your Jira account email.

   - `YOUR_PROJECT_KEY`: The key of the Jira project where you want to create the release.

   - `your-domain`: Your Jira instance domain.

 

4. **Test the Workflow**:

   - Push a new tag that matches your defined pattern (e.g., `v1.0.0`).

   - Check the Actions tab in GitHub to see if the workflow ran successfully.

   - Verify in Jira that a new version has been created.

Jason Chayer
Contributor
October 14, 2024

@Manoj Gangwar - thanks for getting back to me. I will try this and let you know how it works.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events