-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Create Jira release | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
JIRA_RELEASE_WEBHOOK: | ||
required: true | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
create-jira-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Collect and report issues to jira | ||
run: | | ||
./scripts/create-jira-release.sh ${{ inputs.tag }} ${{ secrets.JIRA_RELEASE_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
create-jira-release: | ||
secrets: | ||
jira_release_webhook: ${{ secrets.JIRA_RELEASE_WEBHOOK }} | ||
uses: equinor/ecalc/.github/workflows/create-jira-release.yml@main | ||
with: | ||
tag: ${GITHUB_REF#refs/tags/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eou pipefail | ||
|
||
release_version=$1 | ||
webhook_url=$2 | ||
|
||
# Create array of sorted tags | ||
mapfile -t tags < <(git tag | sort -Vr) | ||
|
||
echo "Found tags:" | ||
echo "${#tags[@]}" | ||
|
||
# Loop array to find previous tag | ||
for ((i=0; i < "${#tags[@]}"; i++)); do | ||
if [[ "$release_version" = "${tags[$i]}" ]]; then | ||
previous_tag="${tags[($i + 1)]}" | ||
break | ||
fi | ||
done | ||
|
||
echo "Found previous release $previous_tag" | ||
|
||
mapfile -t issues < <(git log "$previous_tag".."$release_version" | grep -oP 'ECALC-\d+') | ||
issues_json=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${issues[@]}") | ||
|
||
# Create webhook body | ||
body=$(jq --arg libecalcVersion "$release_version" --argjson issues_json "$issues_json" -Rn '{"issues": $issues_json|unique, "libecalcVersion": $libecalcVersion}') | ||
|
||
echo "$body" | ||
|
||
# Trigger webhook | ||
curl -X POST -H 'Content-type: application/json' --silent --output /dev/null --data "$body" "$webhook_url" |