From e9c31bc0c332e3e387321b951bfb3173fc0975e8 Mon Sep 17 00:00:00 2001 From: Julien WITTOUCK Date: Fri, 25 Jun 2021 10:14:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20:=20add=20contribution=20guideli?= =?UTF-8?q?nes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add CONTRIBUTING.md & pull request template resolves #118 --- .github/pull_request_template.md | 36 +++++++++++ CONTRIBUTING.md | 103 ++++++++++++++++++++++++------- 2 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..f54f94832 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,36 @@ +## Description + +(Add a description of your pull request & feature here. +pull requests without an adequate description will not be reviewed until one is added.) + +## Checklist for the pull request author + +- [ ] Tests added for this feature +- [ ] Commit messages follow conventions (see [CONTRIBUTING.md](CONTRIBUTING.md)) +- [ ] Commits are combined ( 1 commit / type and scope ) +- [ ] Documentation created / updated (if necessary) +- [ ] No new sonarqube issues added +- [ ] CI pipeline is OK +- [ ] Pull request is fast-forward to the `main` branch +- [ ] The last commit of this merge request : + - [ ] updates the `pom.xml` to a new minor or major version + - [ ] updates the `CHANGELOG.md` + +## Checklist for the project maintainer + +- [ ] Review the code, and add a *Review Approval* if everything is ok +- [ ] This pull request will be merged in merge-commit mode + - (in github or with the CLI, see [CONTRIBUTING.md](CONTRIBUTING.md)) + +### After the merge + +- [ ] Put the tag on the merged commit + - (in github or with the CLI, see [CONTRIBUTING.md](CONTRIBUTING.md)) +- [ ] Follow the pipeline for the tag, which should build & release the package (maven or docker) + +## Issues / Links + +* Documentation PR : (eg: gaia-app/docs#1) + +(Please add issues resolution information when needed) + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffd022a74..b42102c6c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,43 +1,98 @@ -# CONTRIBUTING +# CONTRIBUTING.md -## Releasing a new version +This document describes the contribution guidelines for this project. -### Creating a release branch +## Commit convention -New versions are released using Git Flow release branches. +This projects follows the *gitmoji* commit message convention (see [https://gitmoji.dev/](https://gitmoji.dev/)) -When releasing a new version, create a branch using the version number to be released. +Commits message are build this way: -```bash -git checkout -b release/1.3.0 ``` + : -### Bump the version number +
-Change the version number in the `pom.xml` file. - -### Generating the CHANGELOG.md - -We use `gitmoji-changelog` to generate the `CHANGELOG.md` file. +resolves # +``` -The `CHANGELOG.md` should be generated just after bumping the version number in the `pom.xml` file. +The `` can be an emoji code (such as :sparkles:) or a unicode character (such as ✨). -```bash -# install gitmoji-changelog -npm install -g gitmoji-changelog +## How to add a feature -# generate the changelog -gitmoji-changelog --preset maven +* create a branch for the feature (eg: `feature/my-nice-feature`) +```shell +git checkout -b feature/my-nice-feature +``` +* code your feature, and create commits for each subject/scope +* update the `pom.xml` to the next minor or major version (eg: 1.0.1 -> 1.1.0) +* commit the change to the `pom.xml` eg: +```shell +git add pom.xml && git commit -m "🔖 : bump version to 1.1.0" +``` +* generate the CHANGELOG.md for the new version +```shell +npx gitmoji-changelog --preset maven --group-similar-commits true +``` +* commit the CHANGELOG.md in the previous commit +```shell +git add CHANGELOG.md && git commit --amend --no-edit +``` +* when done, push your branch, and open a merge request, with the pull request template. +```shell +git push --set-upstream origin feature/my-nice-feature ``` -### Commit & PR +### Merging the feature -Commit those changes, and open a pull-request for the release-branch. +* merge the feature branch in merge-commit mode +```shell +git checkout main +git merge --no-ff feature/my-nice-feature +``` +* create a tag for the feature, on the main branch, on the merge-commit that you just created +```shell +git tag v1.1.0 +git push --tags +``` +* enjoy & follow the automated build of the tag -The commit message should be like `:bookmark: : release 1.3.0`. +## How to add a fix -### Github Release and Tag +* create a branch for the fix (eg: `hotfix/my-nice-fix`) +```shell +git checkout -b hotfix/my-nice-fix +``` +* code your fix, and create commits for each subject +* update the `pom.xml` to the next fix version (eg: 1.0.1 -> 1.0.2) +* commit the change to the `pom.xml` eg: +```shell +git add pom.xml && git commit -m "🔖 : bump version to 1.0.2" +``` +* generate the CHANGELOG.md for the new version +```shell +npx gitmoji-changelog --preset maven --group-similar-commits true +``` +* commit the CHANGELOG.md in the previous commit +```shell +git add CHANGELOG.md && git commit --amend --no-edit +``` +* when done, push your branch, and open a merge request, with the pull request template. +```shell +git push --set-upstream origin hotfix/my-nice-fix +``` -When the PR is merged, create a Github Release, which points on the previous commit, and add the content of the `CHANGELOG.md` to the release. +### Merging the fix +* merge the fix branch in merge-commit mode +```shell +git checkout main +git merge --no-ff hotfix/my-nice-fix +``` +* create a tag for the fix, on the main branch, on the merge-commit that you just created +```shell +git tag v1.0.2 +git push --tags +``` +* enjoy & follow the automated build of the tag