-
Notifications
You must be signed in to change notification settings - Fork 312
99 lines (89 loc) · 4.3 KB
/
release-notes.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: "Release Notes automation"
on:
workflow_dispatch:
inputs:
starting_commit:
type: string
description: Commit from which to start generating the Release Notes (non-inclusive)
required: true
overwrite:
type: boolean
description: Overwrite the content of TODO fields in generated release notes (typically needed for RC1 notes)
required: true
default: false
jobs:
main:
name: Generate Release Notes
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }} branch in ${{ github.repository }} repository.
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Get version
id: get-version
run: "echo \"resolved-version=\
$(mvn
--file ./kura/pom.xml
-Dexec.executable=echo
-Dexec.args='${project.version}'
--quiet exec:exec --non-recursive
-Pjava8
)\" >> \"${GITHUB_OUTPUT}\""
shell: bash
- name: Check file existence
id: check_files
continue-on-error: true
uses: thebinaryfelix/[email protected]
with:
files: './kura/distrib/RELEASE_NOTES.txt'
- name: Files exist
id: get-old-text
if: steps.check_files.outputs.exists == 'true' && github.event.inputs.overwrite == 'false'
run: |
awk '/Description:/ {found=1; next} /^$/ {found=0} found {print}' ./kura/distrib/RELEASE_NOTES.txt > description.txt
awk '/Target Environments:/ {found=1; next} /^$/ {found=0} found {print}' ./kura/distrib/RELEASE_NOTES.txt > target-env.txt
awk '/Known Issues:/ {found=1; next} /^$/ {found=0} found {print}' ./kura/distrib/RELEASE_NOTES.txt > known-issues.txt
shell: bash
- name: Download git-changelog-command-line tool
id: download-changelog-cli
uses: clausnz/github-action-download-maven-artifact@master
with:
url: 'https://repo1.maven.org'
repository: 'maven2'
groupId: 'se.bjurr.gitchangelog'
artifactId: 'git-changelog-command-line'
version: '1.100.2'
extension: 'jar'
- name: Generate Release Notes
run: |
java -jar ${{ steps.download-changelog-cli.outputs.file }} \
-fc "${{ github.event.inputs.starting_commit }}" \
-ex "{\"version\":\"${{ steps.get-version.outputs.resolved-version }}\"}" \
-t .github/release_notes_template/template.hbs \
-hhf .github/release_notes_template/helper.hbs \
-of ./kura/distrib/RELEASE_NOTES.txt
- name: Files exist write description
id: get-description
if: steps.check_files.outputs.exists == 'true' && github.event.inputs.overwrite == 'false'
# Only runs if all of the files exist
run: |
awk 'NR==FNR { desc = (desc == "" ? $0 : desc "\n" $0); next } /\[TODO\]/ && !done { sub(/\[TODO\]/, desc); done=1 } 1' description.txt done=0 ./kura/distrib/RELEASE_NOTES.txt > tmpfile && mv tmpfile ./kura/distrib/RELEASE_NOTES.txt
awk 'NR==FNR { desc = (desc == "" ? $0 : desc "\n" $0); next } /\[TODO\]/ && !done { sub(/\[TODO\]/, desc); done=1 } 1' target-env.txt done=0 ./kura/distrib/RELEASE_NOTES.txt > tmpfile && mv tmpfile ./kura/distrib/RELEASE_NOTES.txt
awk 'NR==FNR { desc = (desc == "" ? $0 : desc "\n" $0); next } /\[TODO\]/ && !done { sub(/\[TODO\]/, desc); done=1 } 1' known-issues.txt done=0 ./kura/distrib/RELEASE_NOTES.txt > tmpfile && mv tmpfile ./kura/distrib/RELEASE_NOTES.txt
shell: bash
- name: Files exist clean up
id: clean-up-files
if: steps.check_files.outputs.exists == 'true' && github.event.inputs.overwrite == 'false'
# Only runs if all of the files exist
run: |
rm description.txt
rm target-env.txt
rm known-issues.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: "chore: add Kura ${{ steps.get-version.outputs.resolved-version }} release notes"
commit-message: "chore: add Kura ${{ steps.get-version.outputs.resolved-version }} release notes"
body: "Automated changes by _Release Notes automation_ action: add Kura ${{ steps.get-version.outputs.resolved-version }} version release notes since commit `${{ github.event.inputs.starting_commit }}`"
branch-suffix: short-commit-hash