2020-07-05 22:38:14 -04:00
# Release
2020-12-11 03:46:56 -05:00
2020-09-30 20:49:35 -04:00
A guide on how to generate a release.
2020-07-05 22:38:14 -04:00
2021-07-20 16:19:01 -04:00
## Clean environment before generating new release
2020-12-11 03:46:56 -05:00
2021-07-20 20:14:24 -04:00
Before the cleaning, check if existing file isn't committed, not pushed or in stash.
2021-07-20 00:31:15 -04:00
2021-07-16 18:56:58 -04:00
```bash
./.venv/repo forall -pc "git stash list"
./script/git_show_code_diff_repo_manifest.py
```
2021-07-20 16:19:01 -04:00
This will erase everything in addons. Useful before creating docker, manifest and do a release.
2020-12-11 03:46:56 -05:00
```bash
./script/clean_repo_manifest.sh
```
And update all from dev to merge into prod.
```bash
./script/install_locally_dev.sh
```
2021-07-20 00:31:15 -04:00
## Validate environment
2021-07-20 16:19:01 -04:00
- Check if [manifest/default.dev.xml ](../manifest/default.dev.xml ) is ready for production.
2021-07-20 20:14:24 -04:00
- Run test :
```bash
make test
```
2021-07-20 00:31:15 -04:00
2021-07-20 20:00:41 -04:00
### Format code
2021-07-20 20:14:24 -04:00
To format all code, run:
```bash
make format
```
2021-07-20 20:00:41 -04:00
2021-07-20 00:31:15 -04:00
### Update image_db
2021-07-20 20:14:24 -04:00
To generate database images in directory `./image_db` , run:
```bash
2022-01-24 14:03:38 -05:00
make config_gen_all
2021-07-20 20:14:24 -04:00
make image_db_create_all
```
2021-07-20 16:39:57 -04:00
### Update documentations
2021-07-20 20:14:24 -04:00
To generate Markdown in directory `./doc` , run:
```bash
make doc_markdown
```
2021-07-01 03:37:25 -04:00
2021-07-20 00:31:15 -04:00
### Test docker generate
2021-07-20 20:14:24 -04:00
To generate a docker, run:
```bash
make docker_build
```
2021-07-01 03:37:25 -04:00
2021-09-27 23:29:13 -04:00
### Rename old version to new version
Search old version, like :
```bash
grep --color=always --exclude-dir={.repo,.venv,.git} --exclude="*.svg" -nri v1.2.0
```
Replace if need it to new version.
2022-01-24 14:03:38 -05:00
Update file `./pyproject.toml` in [tool.poetry], line `version =` .
2021-07-20 02:56:14 -04:00
### Test production Ubuntu environment
2021-07-20 16:07:22 -04:00
Follow instructions in [PRODUCTION.md ](./PRODUCTION.md ).
Test installation with code generator Geomap:
2021-07-20 20:14:24 -04:00
2021-07-20 16:07:22 -04:00
```bash
make addons_install_code_generator_full
```
2021-07-20 02:56:14 -04:00
2020-12-11 03:46:56 -05:00
## Generate new prod and release
Generate production manifest and freeze all repos versions.
2020-07-05 22:38:14 -04:00
```bash
2020-07-24 02:20:30 -04:00
./.venv/repo manifest -r -o ./default.xml
2020-07-05 22:38:14 -04:00
```
2020-12-11 03:46:56 -05:00
2021-07-21 01:02:32 -04:00
Update ERPLIBRE_VERSION variable in [env_var.sh ](../env_var.sh ), [Dockerfile.prod ](../docker/Dockerfile.prod.pkg ) and [docker-compose ](../docker-compose.yml ).
2020-12-11 03:46:56 -05:00
Generate [poetry ](./POETRY.md ) and keep only missing dependencies, remove updates.
2021-07-20 00:31:15 -04:00
2020-07-05 22:38:14 -04:00
```bash
2020-12-11 03:46:56 -05:00
./script/poetry_update.py
2020-07-05 22:38:14 -04:00
```
2020-12-11 03:46:56 -05:00
When running script poetry_update.py, note manually inserted dependencies, stash all changes and add it manually.
2021-07-20 00:31:15 -04:00
2020-12-11 03:46:56 -05:00
```bash
poetry add DEPENDENCY
```
2020-09-29 19:37:21 -04:00
2020-12-11 03:46:56 -05:00
Understand differences from last release:
2020-09-29 19:37:21 -04:00
2020-12-11 03:46:56 -05:00
```bash
# Get all differences between the last tag and HEAD, to update the CHANGELOG.md
# ERPLibre
git diff v#.#.#..HEAD
# All repo
./.venv/repo forall -pc "git diff ERPLibre/v#.#.#..HEAD"
```
2021-07-01 03:18:56 -04:00
Simplification tools:
2021-07-20 00:31:15 -04:00
2021-07-01 03:18:56 -04:00
```bash
2021-07-16 00:13:05 -04:00
# Show all divergence repository with production
make repo_diff_manifest_production
2022-01-24 23:38:34 -05:00
# Short version with statistics
2021-07-01 03:18:56 -04:00
make repo_diff_stat_from_last_version
# Long version
make repo_diff_from_last_version
```
2020-12-11 03:46:56 -05:00
Update file [CHANGELOG.md ](../CHANGELOG.md ) and create a section with new version, use next command to read all changes.
Create a branch release/#.#.# and create a pull request to branch master with your commit:
```bash
git commit -am "Release v#.#.#"
```
2021-09-27 23:29:13 -04:00
Review by your peers, test the docker file and **merge to master** .
```bash
git checkout master
git merge --no-ff RELEASE_BRANCH
```
Add comment `Release v#.#.#` .
2020-12-11 03:46:56 -05:00
2021-07-16 04:29:23 -04:00
## Generate image db to accelerate db installation
2021-07-20 16:19:01 -04:00
Generate image db before tag, the image is stored in directory ./image_db
2021-07-16 04:29:23 -04:00
```bash
make image_db_create_all
```
To test it, you need to clean caches and install it:
```bash
./script/db_restore.py --clean_cache
./script/db_restore.py --database test --image erplibre_website
```
2020-12-11 03:46:56 -05:00
## Create tag
2020-07-06 01:31:21 -04:00
2020-09-30 20:49:35 -04:00
Add a tag on the commit in branch master with your release. When adding tag, be sure to update default.xml
2020-12-11 03:46:56 -05:00
2020-07-11 05:12:47 -04:00
```bash
git tag v#.#.#
# Push your tags
git push --tags
2020-07-11 21:13:44 -04:00
# Add tags for all repo
2020-07-24 02:20:30 -04:00
./.venv/repo forall -pc "git tag ERPLibre/v#.#.#"
2021-07-16 00:56:30 -04:00
make tag_push_all
2020-07-11 05:12:47 -04:00
```
2020-07-11 21:13:44 -04:00
2020-12-11 03:46:56 -05:00
## Generate and push docker
Important to generate container after push git tags, otherwise the git version will be wrong.
2020-11-20 23:54:44 -05:00
When building your docker with script
2021-06-30 22:26:20 -04:00
> make docker_build_release
2020-11-20 23:54:44 -05:00
List your docker version
2020-12-12 01:15:23 -05:00
> docker images
2020-11-20 23:54:44 -05:00
You need to push your docker image and update your tag, like 1.0.1:
> docker push technolibre/erplibre:VERSION
2020-10-03 01:36:29 -04:00
2022-01-24 14:03:38 -05:00
## Do a release on github
Visit `https://github.com/ERPLibre/ERPLibre/releases/new` and create a release named `v#.#.#` and copy information from CHANGELOG.md.
2020-07-05 22:38:14 -04:00
# TIPS
2020-12-11 03:46:56 -05:00
2020-09-30 20:49:35 -04:00
## Compare repo differences with another ERPLibre project
2020-12-11 03:46:56 -05:00
To generate a list of differences between repo git commit
2020-07-05 22:38:14 -04:00
```bash
2020-07-11 05:12:47 -04:00
./script/git_change_remote.py --sync_to /path/to/directory
2021-07-20 16:19:01 -04:00
```