diff --git a/.github/release_notes_template/helper.hbs b/.github/release_notes_template/helper.hbs new file mode 100644 index 00000000000..409b72166c9 --- /dev/null +++ b/.github/release_notes_template/helper.hbs @@ -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; +}); diff --git a/.github/release_notes_template/template.hbs b/.github/release_notes_template/template.hbs new file mode 100644 index 00000000000..ad22de1b4f6 --- /dev/null +++ b/.github/release_notes_template/template.hbs @@ -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}} diff --git a/.github/version_uptick_configs/uptick_major_on_develop_branch.yml b/.github/version_uptick_configs/uptick_major_on_develop_branch.yml new file mode 100644 index 00000000000..b1e9334562c --- /dev/null +++ b/.github/version_uptick_configs/uptick_major_on_develop_branch.yml @@ -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 diff --git a/.github/version_uptick_configs/uptick_minor_on_develop_branch.yml b/.github/version_uptick_configs/uptick_minor_on_develop_branch.yml new file mode 100644 index 00000000000..fcf993cd7f3 --- /dev/null +++ b/.github/version_uptick_configs/uptick_minor_on_develop_branch.yml @@ -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 diff --git a/.github/version_uptick_configs/uptick_patch_on_maintenance_branch.yml b/.github/version_uptick_configs/uptick_patch_on_maintenance_branch.yml new file mode 100644 index 00000000000..5e929b3bd80 --- /dev/null +++ b/.github/version_uptick_configs/uptick_patch_on_maintenance_branch.yml @@ -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 diff --git a/.github/version_uptick_configs/uptick_snapshot_to_patch_release.yml b/.github/version_uptick_configs/uptick_snapshot_to_patch_release.yml new file mode 100644 index 00000000000..080afc1da5f --- /dev/null +++ b/.github/version_uptick_configs/uptick_snapshot_to_patch_release.yml @@ -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 + diff --git a/.github/version_uptick_configs/uptick_snapshot_to_release.yml b/.github/version_uptick_configs/uptick_snapshot_to_release.yml new file mode 100644 index 00000000000..4dcad09a015 --- /dev/null +++ b/.github/version_uptick_configs/uptick_snapshot_to_release.yml @@ -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 diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 00000000000..f2ebbdb1f0d --- /dev/null +++ b/.github/workflows/backport.yml @@ -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 %>]" + diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 00000000000..d1a1a04914a --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -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 diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml new file mode 100644 index 00000000000..320432e05e9 --- /dev/null +++ b/.github/workflows/semantic-pr.yml @@ -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 diff --git a/.github/workflows/version-uptick.yml b/.github/workflows/version-uptick.yml new file mode 100644 index 00000000000..caafac70ad3 --- /dev/null +++ b/.github/workflows/version-uptick.yml @@ -0,0 +1,66 @@ +name: Version uptick automation + +on: + workflow_dispatch: + inputs: + target_branch: + type: string + default: 'develop' + required: true + uptick_config: + type: choice + description: Configuration to use for the uptick + options: + - uptick_major_on_develop_branch.yml + - uptick_minor_on_develop_branch.yml + - uptick_patch_on_maintenance_branch.yml + - uptick_snapshot_to_patch_release.yml + - uptick_snapshot_to_release.yml + required: true + +jobs: + uptick: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.target_branch }} + + - name: Download version upticker tool + uses: carlosperate/download-file-action@v1 + with: + file-url: https://kura-repo.s3.us-west-2.amazonaws.com/esf_upticker_tool/version-uptick-0.2.0-linux-x86_64 + + - name: Make the uptick tool executable + run: | + chmod +x ./version-uptick-0.2.0-linux-x86_64 + shell: bash + + - name: Run the uptick tool + run: | + ./version-uptick-0.2.0-linux-x86_64 \ + --commit --trace process-versions \ + --config-path .github/version_uptick_configs/${{ github.event.inputs.uptick_config }} \ + --root-dir . + shell: bash + + - name: Cleanup uptick tool + run: | + rm ./version-uptick-0.2.0-linux-x86_64 + shell: bash + + - name: Get version + id: get-version + uses: JActions/maven-version@v1.0.1 + with: + pom: ./kura/pom.xml + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + title: "chore: automated uptick to ${{ steps.get-version.outputs.version }}" + commit-message: "chore: automated uptick to ${{ steps.get-version.outputs.version }}" + body: "Automated changes by _Version uptick automation_ action: automated uptick to ${{ steps.get-version.outputs.version }} version" + branch-suffix: short-commit-hash