-
Notifications
You must be signed in to change notification settings - Fork 47
63 lines (62 loc) · 2.55 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Jira release creator
on:
release:
types: [published]
jobs:
create-ticket:
runs-on: ubuntu-22.04
name: Create a CCB ticket in Jira
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
coverage: none
- name: Install dependencies
run: composer install --optimize-autoloader --no-interaction
- name: Generate Jira ticket body
env:
GITHUB_ACTIONS_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
RELEASE_BODY: ${{ github.event.release.body }}
JIRA_BASE_URL: ${{ vars.JIRA_BASE_URL }}
run: |
${GITHUB_WORKSPACE}/.github/workflows/create-ccb-ticket.sh "$RELEASE_BODY" "${{ github.event.release.name }}" "${{ github.event.release.html_url }}" "$GITHUB_ACTIONS_RUN_URL" "$JIRA_BASE_URL" >> jira_description.md
JIRA_DESCRIPTION=$(<jira_description.md)
echo "JIRA_DESCRIPTION<<EOF" >> $GITHUB_ENV
echo "$JIRA_DESCRIPTION" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
shell: bash
- name: Login to Jira
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ vars.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
- name: Create fix version
run: |
curl --request POST \
--url "$JIRA_BASE_URL/rest/api/2/version" \
--user "$JIRA_USER_EMAIL:$JIRA_API_TOKEN" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data "{
\"name\": \"$FIX_VERSION\",
\"projectId\": 20084
}"
env:
JIRA_BASE_URL: ${{ vars.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
FIX_VERSION: Acquia CLI ${{ github.event.release.name }}
- name: Create CCB ticket in Jira
id: create
uses: atlassian/gajira-create@v3
with:
project: CLI
issuetype: Release
summary: "${{ env.FIX_VERSION }}"
description: "${{ env.JIRA_DESCRIPTION }}"
fields: '{"components": [{"id": "25474"}], "labels": ["ccb_std_017"], "customfield_10004": {"id": "15710"}, "fixVersions": [{"name": "${{ env.FIX_VERSION }}"}]}'
env:
FIX_VERSION: Acquia CLI ${{ github.event.release.name }}
- name: Log created issue
run: echo "Issue ${{ steps.create.outputs.issue }} was created"