Skip to content

Commit c7589f5

Browse files
authored
docs(CRC-70): Branching model and release docs (#17)
* docs: Add docs about branching model and release process * docs: Add docs about merging strategy * docs: Add links to commong contributing guidelines to each package
1 parent bf42d6f commit c7589f5

File tree

9 files changed

+11565
-16
lines changed

9 files changed

+11565
-16
lines changed

.github/CONTRIBUTING.md

Lines changed: 97 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ Thank you for being part of the Telefónica Innovación Digital Open Source Comm
66

77
- [Getting started](#getting-started)
88
- [Component tasks](#component-tasks)
9+
- [Branching model](#branching-model)
10+
- [Pull Request](#pull-request)
11+
- [Release process](#release-process)
12+
- [Versioning](#versioning)
13+
- [Publishing](#publishing)
914
- [License](#license)
1015
- [Licensing of new files](#licensing-of-new-files)
1116
- [Public Domain](#public-domain)
12-
- [Pull Request](#pull-request)
1317
- [Code of Conduct](#code-of-conduct)
1418
- [Contributor License Agreement](#contributor-license-agreement)
1519

@@ -23,6 +27,9 @@ Every component has to be created in the `components` folder. Each one must cont
2327

2428
To get started, clone the repository and install the dependencies:
2529

30+
> [!WARNING]
31+
> Some repository components may depend on packages published in the xcut npm registry. Please login to the registry before installing the dependencies following the instructions in the [Cross NPM Confluence page](https://confluence.tid.es/display/CTO/%5BCross%5D+NPM+Packages).
32+
2633
```bash
2734
pnpm install
2835
```
@@ -65,6 +72,95 @@ pnpm nx run-many test:unit --all
6572

6673
This will run the `test:unit` task in all components and also the corresponding dependencies, in the right order, so everything is built and tested correctly.
6774

75+
# Branching model
76+
77+
Here you have an schema of the branching model used in this repository:
78+
79+
[![Branching model](../docs/branching-model.png)](../docs/branching-model.png)
80+
81+
Some important points to consider:
82+
83+
* __The "main" branch must always reflect the latest stable published version of the packages in the repository__.
84+
* We have a "release" branch for the following reasons:
85+
* To enable the maintainer to prepare the release of features without having to promote any unpublished changes to the "main" branch. By preparing the release we mainly mean to decide how to group changes in different releases and to update the `CHANGELOG.md` files and the version numbers of the packages accordingly.
86+
* It is long-lived because we also have bots that will open PRs. So, they can be configured to open PRs to the "release" branch, and their changes will also enter in the process of preparing the release, such as changes from any other contributor.
87+
* __The "release" branch is the default branch for PRs.__ Only a project maintainer should open a PR to the "main" branch, and only when the release is ready to be published.
88+
* Usually, feature branches should be short-lived, and they should be merged into the "release" branch as soon as possible. This way, the changes will be included in the next release, and the feature branch can be deleted.
89+
* When necessary, a medium-lived branch can be created from the "release" branch to group changes that will be released together and require more time to be prepared. Once the changes are ready, the branch can be merged into the "release" branch.
90+
* For publishing beta versions or fix versions of precedent releases, medium-lived branches should be also created from the "release" branch, and the publish workflow should be modified accordingly to add the `--tag` option to the `pnpm publish` command. In this case, the maintainer should tag the releases directly in the branch without merging it into the "release" branch. When the code is ready to be published as a stable release, a PR should be opened to the "release" branch, and the branch should be deleted after the PR is merged.
91+
92+
## Merging strategy
93+
94+
We use the __squash and merge strategy for merging PRs to the release branch__. This means that all the changes in the PR will be squashed into a single commit before being merged. The reasons are:
95+
96+
* To keep the history clean in the release branch
97+
* To make easier to understand the changes in each release.
98+
99+
But we use the __merge commit strategy for merging PRs to the main branch from the release branch__. The reasons are:
100+
101+
* To keep in the history the information about the features that were merged separately into the release branch. This is very important, because we may have changes from different packages in the release branch. Squashing all the changes into a single commit would make it difficult to understand or revert the changes for a specific package.
102+
* To avoid having to rebase the release branch every time a PR is merged to the main branch.
103+
104+
# Pull Request
105+
106+
When you're finished with the changes, please ensure the following:
107+
108+
* You have added tests for your changes.
109+
* You have updated the documentation if necessary.
110+
* You have run the linter and fixed any issues.
111+
* __You have added the necessary changes to the `CHANGELOG.md` file__, under the "unreleased" section at the beginning of the file.
112+
* You have modified the version of the package in the `package.json` file according to the [versioning](#versioning) section.
113+
114+
When you have checked these points, then you are ready to submit your pull request. To do so, follow these steps:
115+
116+
* __The target branch for the PR should be `release`.__ (Read [branching-model](#branching-model) for more information)
117+
* Fill the PR template. This template helps reviewers understand your changes as well as the purpose of your pull request.
118+
* Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue) if you are solving one.
119+
* Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge. Once you submit your PR, a maintainer will review your proposal. We may ask questions or request additional information.
120+
* We may ask for changes to be made before a PR can be merged, either using suggested changes or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
121+
* As you update your PR and apply changes, mark each conversation as resolved.
122+
* If you run into any merge issues, checkout this git tutorial to help you resolve merge conflicts and other issues.
123+
124+
# Release process
125+
126+
## Versioning
127+
128+
First of all, you should know that the repository follows the [Semantic Versioning](https://semver.org/) specification. This means that the version number is composed of three parts: `MAJOR.MINOR.PATCH`. __Each package in the repository has its own version number, and it is independent of the others.__ (Except for the dependencies between them, of course)
129+
130+
Please, follow these rules to update the version number:
131+
132+
* __MAJOR__: When you make incompatible API changes.
133+
* __MINOR__: When you add functionality in a backwards-compatible manner.
134+
* __PATCH__: When:
135+
* You make backwards-compatible bug fixes.
136+
* You bump the version of a dependency which doesn't affect the API of the package. __This includes internal dependencies.__
137+
138+
> ![WARNING]
139+
> Remember to modify the version of the packages affected by the change in another package. For example, if you modify a package that is used by another one, you should update the version of the dependent package.
140+
You can use the `pnpm nx graph` command to see the dependencies between the packages. In the future we will try to implement a workflow check to ensure that versions are updated correctly, but for the moment you should do it manually.
141+
142+
## Publishing
143+
144+
Once the PR is approved and merged into the release branch, a project maintainer can start the release process when corresponding (sometimes it is not desired to release the changes immediately, so the maintainer can wait until more changes are merged to release them all together).
145+
146+
The release process is as follows:
147+
148+
* Checkout the `release` branch, and:
149+
* Move changes in the "unreleased" section of the `CHANGELOG.md` files to a new version section that includes the version number and the release date.
150+
* Check that every affected package has the correct version number in the `package.json` file.
151+
* Commit the changes with the message `chore(release): description`.
152+
* Open a PR from the `release` branch to the `main` branch.
153+
* Once the PR is approved and merged, the build pipeline will run in the `main` branch, but packages will not be published yet.
154+
* Create a new release in GitHub for each package modified in the release, following the next instructions:
155+
* Tag: `package-name-vX.Y.Z` (Replace `package-name` with the name of the package and `X.Y.Z` with the version number, of course).
156+
* Title: `package-name vX.Y.Z`
157+
* Description: Copy the changes from the corresponding `CHANGELOG.md` file for the version you are releasing.
158+
* Once the release is created, the packages will be published to the npm registry automatically. __For the moment, creating any release will trigger the publication of all the packages__. If you have to release more than one package there is no problem, next executions will do nothing if the package is already published.
159+
NOTE: Publishing all packages when the first release is created has been done to avoid having packages without dependencies published due to possible errors when creating releases for each package manually. In the future, we could only release the target package based on the release tag, but some extra checks should be implemented in order to ensure that the dependencies are published before the dependent packages.
160+
161+
> [!WARNING]
162+
> Some special cases may require a different process in order to avoid those versions being tagged as "latest" in the npm registry, such as publishing beta versions, or publishing fix versions of precedent releases. In such case, the release tag should be created on a branch different from "main". Read the [branching model section](#branching-model) for more information.
163+
68164
# License
69165

70166
By contributing to this project, you agree that your contributions will be licensed under the [LICENSE](../LICENSE) file in the root of this repository, and that you agree to the [Contributor License Agreement](#contributor-license-agreement).
@@ -114,17 +210,6 @@ SPDX-FileCopyrightText: {{ year }} Telefónica Innovación Digital and contribu
114210
SPDX-License-Identifier: MIT
115211
```
116212

117-
# Pull Request
118-
119-
When you're finished with the changes, create a pull request, also known as a PR.
120-
121-
* Fill the PR template. This template helps reviewers understand your changes as well as the purpose of your pull request.
122-
* Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue) if you are solving one.
123-
* Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge. Once you submit your PR, a maintainer will review your proposal. We may ask questions or request additional information.
124-
* We may ask for changes to be made before a PR can be merged, either using suggested changes or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
125-
* As you update your PR and apply changes, mark each conversation as resolved.
126-
* If you run into any merge issues, checkout this git tutorial to help you resolve merge conflicts and other issues.
127-
128213
# Code of Conduct
129214

130215
Please read our [Code of Conduct](../.github/CODE_OF_CONDUCT.md) before contributing.

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"files.associations": {
3-
"nx.json": "jsonc",
4-
"**/project.json": "jsonc"
5-
}
2+
"files.associations": {
3+
"nx.json": "jsonc",
4+
"**/project.json": "jsonc"
5+
}
66
}

components/child-process-manager/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ First of all, thank you for considering contributing to the this project! 🎉
55
# Table of contents
66

77
- [Development](#development)
8+
- [Common guidelines](#common-guidelines)
89
- [Installation](#installation)
910
- [Monorepo tool](#monorepo-tool)
1011
- [Unit tests](#unit-tests)
@@ -15,6 +16,10 @@ First of all, thank you for considering contributing to the this project! 🎉
1516

1617
## Development
1718

19+
### Common guidelines
20+
21+
Please refer to the main [CONTRIBUTING.md](../../.github/CONTRIBUTING.md) file in this repository for general guidelines about contributing to this project. Once you have read and understood them, you can follow the specific guidelines for this component.
22+
1823
### Installation
1924

2025
This repository use Pnpm as dependencies manager. So, to start working on them, you have to install the dependencies by running `pnpm install` in the root folder of the repository.

components/confluence-sync/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ First of all, thank you for considering contributing to the this project! 🎉
55
# Table of contents
66

77
- [Development](#development)
8+
- [Common guidelines](#common-guidelines)
89
- [Installation](#installation)
910
- [Monorepo tool](#monorepo-tool)
1011
- [Unit tests](#unit-tests)
@@ -15,6 +16,10 @@ First of all, thank you for considering contributing to the this project! 🎉
1516

1617
## Development
1718

19+
### Common guidelines
20+
21+
Please refer to the main [CONTRIBUTING.md](../../.github/CONTRIBUTING.md) file in this repository for general guidelines about contributing to this project. Once you have read and understood them, you can follow the specific guidelines for this component.
22+
1823
### Installation
1924

2025
This repository use Pnpm as dependencies manager. So, to start working on them, you have to install the dependencies by running `pnpm install` in the root folder of the repository.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
automerge
22
cacheable
3+
excalidraw
34
frontmatter
45
nrwl
56
syncrc

components/cspell-config/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function createConfig(config = {}) {
2020
"**/.gitignore",
2121
"**/coverage/**",
2222
"**/dist/**",
23+
"**/*.excalidraw",
2324
],
2425
caseSensitive: false,
2526
// Language - current active spelling language

components/markdown-confluence-sync/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ First of all, thank you for considering contributing to the this project! 🎉
55
# Table of contents
66

77
- [Development](#development)
8+
- [Common guidelines](#common-guidelines)
89
- [Installation](#installation)
910
- [Monorepo tool](#monorepo-tool)
1011
- [Unit tests](#unit-tests)
@@ -16,6 +17,10 @@ First of all, thank you for considering contributing to the this project! 🎉
1617

1718
## Development
1819

20+
### Common guidelines
21+
22+
Please refer to the main [CONTRIBUTING.md](../../.github/CONTRIBUTING.md) file in this repository for general guidelines about contributing to this project. Once you have read and understood them, you can follow the specific guidelines for this component.
23+
1924
### Installation
2025

2126
This repository use Pnpm as dependencies manager. So, to start working on them, you have to install the dependencies by running `pnpm install` in the root folder of the repository.

0 commit comments

Comments
 (0)