Skip to content

Commit

Permalink
chore: Aligned github actions to develop
Browse files Browse the repository at this point in the history
Signed-off-by: MMaiero <matteo.maiero@eurotech.com>
  • Loading branch information
MMaiero committed Nov 4, 2022
1 parent 0cf89d1 commit fd5661f
Show file tree
Hide file tree
Showing 11 changed files with 398 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/release_notes_template/helper.hbs
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;
});
71 changes: 71 additions & 0 deletions .github/release_notes_template/template.hbs
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}}
23 changes: 23 additions & 0 deletions .github/version_uptick_configs/uptick_major_on_develop_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
exclusions:
- "**/.git/**/*"
- "**/.github/**/*"
- "**/target/**/*"
- "**/RELEASE_INFO/**/*"
- "**/.settings/**/*"
- "**/.classpath"
- "**/.project"
- "./kura/tools/archetype/example/src/main/resources/**/*"

tasks:
- selector:
and:
- snapshot
- not:
artifact_id: "moquette-broker"
actions:
- print
- transform_version:
- add_major: 1
- set_minor: 0
- set_patch: 0
22 changes: 22 additions & 0 deletions .github/version_uptick_configs/uptick_minor_on_develop_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
exclusions:
- "**/.git/**/*"
- "**/.github/**/*"
- "**/target/**/*"
- "**/RELEASE_INFO/**/*"
- "**/.settings/**/*"
- "**/.classpath"
- "**/.project"
- "./kura/tools/archetype/example/src/main/resources/**/*"

tasks:
- selector:
and:
- snapshot
- not:
artifact_id: "moquette-broker"
actions:
- print
- transform_version:
- add_minor: 1
- set_patch: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
exclusions:
- "**/.git/**/*"
- "**/.github/**/*"
- "**/target/**/*"
- "**/RELEASE_INFO/**/*"
- "**/.settings/**/*"
- "**/.classpath"
- "**/.project"
- "./kura/tools/archetype/example/src/main/resources/**/*"

tasks:
- selector:
and:
- release
- not:
artifact_id: "moquette-broker"
actions:
- print
- transform_version:
- add_patch: 1
- snapshot: set
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
exclusions:
- "**/.git/**/*"
- "**/.github/**/*"
- "**/target/**/*"
- "**/RELEASE_INFO/**/*"
- "**/.settings/**/*"
- "**/.classpath"
- "**/.project"
- "./kura/tools/archetype/example/src/main/resources/**/*"

tasks:
- selector:
or:
- and:
- group_id: "org.eclipse.kura"
- artifact_id: "distrib"
- and:
- group_id: "org.eclipse.kura"
- artifact_id: "tools"
- and:
- group_id: "org.eclipse.kura"
- artifact_id: "target-platform"
- and:
- group_id: "org.eclipse.kura"
- artifact_id: "examples"
- and:
- group_id: "org.eclipse.kura.tools"
- artifact_id: "archetype"
- and:
- group_id: "org.eclipse.kura"
- artifact_id: "kura"
actions:
- print
- transform_version:
- snapshot: remove

21 changes: 21 additions & 0 deletions .github/version_uptick_configs/uptick_snapshot_to_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
exclusions:
- "**/.git/**/*"
- "**/.github/**/*"
- "**/target/**/*"
- "**/RELEASE_INFO/**/*"
- "**/.settings/**/*"
- "**/.classpath"
- "**/.project"
- "./kura/tools/archetype/example/src/main/resources/**/*"

tasks:
- selector:
and:
- snapshot
- not:
artifact_id: "moquette-broker"
actions:
- print
- transform_version:
- snapshot: remove
28 changes: 28 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Backport
on:
pull_request_target:
types:
- closed
- labeled

jobs:
backport:
name: Backport
runs-on: ubuntu-latest
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
steps:
- uses: tibdex/backport@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
title_template: "<%= title %> [backport <%= base %>]"

60 changes: 60 additions & 0 deletions .github/workflows/release-notes.yml
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.1
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
32 changes: 32 additions & 0 deletions .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
docs
refactor
test
style
chore
build
ci
revert
perf
deprecate
requireScope: false
Loading

0 comments on commit fd5661f

Please sign in to comment.