Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(impl):[TRI-707] add jira release workflow #258

Merged
merged 3 commits into from
Apr 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/jira-publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Jira release publishing

on:
workflow_dispatch: # Trigger manually
inputs:
version:
ds-ext-kmassalski marked this conversation as resolved.
Show resolved Hide resolved
required: true
type: string
description: Version that will be released in Jira, eg. 2.0.0

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set current date as env variable
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Echo current date
run: echo $NOW

- name: Get Version Id Of Release
env:
JIRA_USERNAME: ${{ secrets.RELEASE_IRS_JIRA_USERNAME }}
JIRA_PASSWORD: ${{ secrets.RELEASE_IRS_JIRA_PASSWORD }}
run: |
versionId=$(curl --request GET --url 'https://jira.catena-x.net/rest/api/latest/project/10211/versions' \
--user $JIRA_USERNAME:$JIRA_PASSWORD --header 'Accept: application/json' | jq '.[] | select(.name == "NEXT_RELEASE").id')
echo "Exported $versionId as version id to release"

- name: Release Version in Jira
env:
JIRA_USERNAME: ${{ secrets.RELEASE_IRS_JIRA_USERNAME }}
JIRA_PASSWORD: ${{ secrets.RELEASE_IRS_JIRA_PASSWORD }}
VERSION: ${{ github.event.inputs.version }}
run: |
curl --request PUT --url 'https://jira.catena-x.net/rest/api/latest/version/$versionId' \
--user $JIRA_USERNAME:$JIRA_PASSWORD \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"archived": false,
"description": "$VERSION",
"id": "$versionId",
"name": "$VERSION",
"releaseDate": "$NOW",
"released": true,
"overdue": false,
"projectId": 10211
}'

- name: Create NEXT_RELEASE Version in Jira
env:
JIRA_USERNAME: ${{ secrets.RELEASE_IRS_JIRA_USERNAME }}
JIRA_PASSWORD: ${{ secrets.RELEASE_IRS_JIRA_PASSWORD }}
run: |
curl --request POST --url 'https://jira.catena-x.net/rest/api/latest/version' \
--user $JIRA_USERNAME:$JIRA_PASSWORD \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"archived": false,
"name": "NEXT_RELEASE",
"projectId": 10211,
"released": false
}'