-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ci: add release notes generation workflow (#4011) * ci: add release notes generation workflow Signed-off-by: Mattia Dal Ben <matthewdibi@gmail.com> * ci: fixed changelog format Signed-off-by: Mattia Dal Ben <matthewdibi@gmail.com> * ci: improve PR message body Signed-off-by: Mattia Dal Ben <matthewdibi@gmail.com> Co-authored-by: Mattia Dal Ben <mattdibi@users.noreply.github.com>
- Loading branch information
1 parent
997d973
commit 55d3cd6
Showing
3 changed files
with
147 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,16 @@ | ||
Handlebars.registerHelper('firstLetters', function(input, options) { | ||
const number = parseInt(options.hash['number'] || "0") | ||
return input.substring(0,number); | ||
}); | ||
|
||
Handlebars.registerHelper('date', function() { | ||
const monthNames = ["January", "February", "March", "April", "May", "June", | ||
"July", "August", "September", "October", "November", "December" | ||
]; | ||
|
||
const date = new Date(); | ||
const month = monthNames[date.getMonth()]; | ||
const year = date.getYear() + 1900; | ||
|
||
return month + " " + year; | ||
}); |
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,71 @@ | ||
Eclipse Kura - {{extended.version}} - {{{date}}} | ||
------------------------------------------------------------------------------------------------- | ||
Description: | ||
[TODO] | ||
{{#issues}} | ||
{{! Features section }} | ||
{{#ifContainsType commits type='feat'}} | ||
Features: | ||
{{#commits}} | ||
{{#ifCommitType . type='feat'}} | ||
* {{firstLetters hash number='10'}} - {{#eachCommitScope .}}[{{.}}] {{/eachCommitScope}}{{{commitDescription .}}} ({{authorName}}) | ||
{{/ifCommitType}} | ||
{{/commits}} | ||
{{/ifContainsType}} | ||
{{! Target environments section }} | ||
Target Environments: | ||
[TODO] | ||
{{! Breaking changes section }} | ||
{{#ifContainsBreaking commits}} | ||
Breaking changes: | ||
{{#commits}} | ||
{{#ifCommitBreaking .}} | ||
* {{firstLetters hash number='10'}} - {{#eachCommitScope .}}[{{.}}] {{/eachCommitScope}}{{{commitDescription .}}} ({{authorName}}) | ||
{{/ifCommitBreaking}} | ||
{{/commits}} | ||
{{/ifContainsBreaking}} | ||
{{! Bug Fixes section }} | ||
{{#ifContainsType commits type='fix'}} | ||
Bug Fixes: | ||
{{#commits}} | ||
{{#ifCommitType . type='fix'}} | ||
* {{firstLetters hash number='10'}} - {{#eachCommitScope .}}[{{.}}] {{/eachCommitScope}}{{{commitDescription .}}} ({{authorName}}) | ||
{{/ifCommitType}} | ||
{{/commits}} | ||
{{/ifContainsType}} | ||
{{! Deprecated APIs section }} | ||
{{#ifContainsType commits type='deprecate'}} | ||
Deprecated APIs: | ||
{{#commits}} | ||
{{#ifCommitType . type='deprecate'}} | ||
* {{firstLetters hash number='10'}} - {{{commitDescription .}}} ({{authorName}}) | ||
{{/ifCommitType}} | ||
{{/commits}} | ||
{{/ifContainsType}} | ||
{{! Target Platform updates section }} | ||
{{#ifContainsType commits type='build'}} | ||
Target Platform Updates: | ||
{{#commits}} | ||
{{#ifCommitType . type='build'}} | ||
* {{firstLetters hash number='10'}} - {{{commitDescription .}}} ({{authorName}}) | ||
{{/ifCommitType}} | ||
{{/commits}} | ||
{{/ifContainsType}} | ||
{{! Known issues section }} | ||
Known Issues: | ||
[TODO] | ||
{{! Changelog section }} | ||
Changelog: | ||
{{#commits}} | ||
* {{firstLetters hash number='10'}} - {{{messageTitle}}} ({{authorName}}) | ||
{{/commits}} | ||
{{/issues}} |
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,60 @@ | ||
name: "Release Notes automation" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
target_branch: | ||
type: string | ||
default: 'master' | ||
description: Target branch | ||
required: true | ||
starting_commit: | ||
type: string | ||
description: Commit from which to start generating the release notes | ||
required: true | ||
|
||
jobs: | ||
main: | ||
name: Generate Release Notes | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout target branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.target_branch }} | ||
fetch-depth: '0' | ||
|
||
- name: Get version | ||
id: get-version | ||
uses: JActions/maven-version@v1.0.0 | ||
with: | ||
pom: ./kura/pom.xml | ||
|
||
- 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.version }}\"}" \ | ||
-t .github/release_notes_template/template.hbs \ | ||
-hhf .github/release_notes_template/helper.hbs \ | ||
-of kura/distrib/RELEASE_NOTES.txt | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
title: "chore: add Kura ${{ steps.get-version.outputs.version }} release notes" | ||
commit-message: "chore: add Kura ${{ steps.get-version.outputs.version }} release notes" | ||
body: "Automated changes by _Release Notes automation_ action: add Kura ${{ steps.get-version.outputs.version }} version release notes" | ||
branch-suffix: short-commit-hash |