<commit_before># Deployments

Commits to `master` are automatically deployed to dev and staging environments.

Opening a pull request creates a temporary instance on Heroku called [review app](https://devcenter.heroku.com/articles/github-integration-review-apps) which is pointing to the staging API.

Deployments to production are done manually through Jenkins where a Git tag can be used.

## Deploying to production

1. Create a GIT tag `git tag v<MAJOR>.<MINOR>.<PATCH>`, e.g. `v5.1.2` pointing to the latest `master`

   | Release type      | When to increase                                                                         |
   | ----------------- | ---------------------------------------------------------------------------------------- |
   | Major (**1**.0.0) | When a change requires modifications to the infrastructure, e.g. NodeJS version upgrade. |
   | Minor (0.**1**.0) | When a release contains at least one new feature.                                        |
   | Patch (0.0.**1**) | When a release contains only fixes.                                                      |

2. Push the tag to the remote - `git push origin v<VERSION_NUMBER>`

3. Go to Jenkins and click on `Build with Parameters`.

4. Select `production` for the environment.

5. Type your version number created in step `1` to the `Git_Commit` text field.

6. Press the `Build` button.

7. Create a GH release by clicking `Draft a new release` on the [releases page](https://github.com/uktrade/data-hub-frontend/releases).

   List of changes can be found using the tag-based comparison
   provided by GitHub, i.e. `github.com/uktrade/data-hub-frontend/compare/OLD_TAG…NEW_TAG`

   Example: https://github.com/uktrade/data-hub-frontend/compare/v5.62.1...v5.62.2

   Copy both the PR title and PR number into the release notes allowing us to link a release to pull requests.

   Example: https://github.com/uktrade/data-hub-frontend/releases/tag/v5.82.0

   <commit_msg>Update deployment documentation<commit_after># Deployments

Commits to `master` are automatically deployed to dev and staging environments.

Opening a pull request creates a temporary instance on Heroku called [review app](https://devcenter.heroku.com/articles/github-integration-review-apps) which is pointing to the staging API.

Deployments to production are done manually through Jenkins where a Git tag can be used.

## Deploying to production
1. Post a message into the #data-hub-core-dev channel saying that you want to do a Data Hub frontend release and ask if there are any objections. If no objections, proceed with the following steps.

2. Create a GIT tag `git tag v<MAJOR>.<MINOR>.<PATCH>`, e.g. `v5.1.2` pointing to the latest `master`.

   | Release type      | When to increase                                                                         |
   | ----------------- | ---------------------------------------------------------------------------------------- |
   | Major (**1**.0.0) | When a change requires modifications to the infrastructure, e.g. NodeJS version upgrade. |
   | Minor (0.**1**.0) | When a release contains at least one new feature.                                        |
   | Patch (0.0.**1**) | When a release contains only fixes.                                                      |

You can use the [GitHub comparison tool](https://github.com/uktrade/data-hub-frontend/compare) to figure out what changes have been made since the last release. You can find out the latest release tag number from [here](https://github.com/uktrade/data-hub-frontend/releases).

3. Push the tag to the remote - `git push origin v<VERSION_NUMBER>`.

4. Check that the tag worked by using the [GitHub comparison tool](https://github.com/uktrade/data-hub-frontend/compare) again to compare master to the new tag. If done correctly, there should be no difference. 

5. Go to Jenkins and click on `Build with Parameters`.

6. Select `production` for the environment.

7. Type the `v<VERSION_NUMBER>` created in step `2` into the `Git_Commit` text field.

8. Press the `Build` button.

9. Create a GH release by clicking `Draft a new release` on the [releases page](https://github.com/uktrade/data-hub-frontend/releases).

The release title should be `v<VERSION_NUMBER>` and release notes can be created by clicking the `Auto-generate release notes` button.

10. After the Jenkins build has finished, publish the GH release.

11. Post the following message on the #data-hub slack channel, making sure to put the actual version number and link the release notes:

```
@here Data Hub Frontend v<VERSION_NUMBER> is now live!
For more information see the release notes.
```
{'fraction_non_alphanumeric': 0.12980047200171638, 'fraction_numerical': 0.012443681613387684, 'mean_word_length': 2.3636363636363638, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2927907', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1168, 'n_words': 531}