|
| 1 | +# Releasing |
| 2 | + |
| 3 | +<!-- vim-markdown-toc GFM --> |
| 4 | + |
| 5 | +* [Semantic versioning](#semantic-versioning) |
| 6 | + * [Rules (concise)](#rules-concise) |
| 7 | +* [Prerequisites](#prerequisites) |
| 8 | +* [Update version in sources](#update-version-in-sources) |
| 9 | +* [Regenerate OpenAPI specification](#regenerate-openapi-specification) |
| 10 | +* [Publishing the Python package on PyPi](#publishing-the-python-package-on-pypi) |
| 11 | + * [Cleanup the whole repository](#cleanup-the-whole-repository) |
| 12 | + * [Build the distribution archive](#build-the-distribution-archive) |
| 13 | + * [Upload distribution archives into Python registry](#upload-distribution-archives-into-python-registry) |
| 14 | + * [Check packages on PyPI and Test PyPI](#check-packages-on-pypi-and-test-pypi) |
| 15 | +* [New tag and release on GitHub](#new-tag-and-release-on-github) |
| 16 | + * [Create a new tag](#create-a-new-tag) |
| 17 | + * [Update link in `README.md`](#update-link-in-readmemd) |
| 18 | + |
| 19 | +<!-- vim-markdown-toc --> |
| 20 | + |
| 21 | +## Semantic versioning |
| 22 | + |
| 23 | +Each LCORE release is identified by semantic version. |
| 24 | + |
| 25 | +Semantic Versioning (SemVer) is a versioning scheme that conveys meaning about |
| 26 | +changes in a release using a three-part number: `MAJOR.MINOR.PATCH`. In LCORE it |
| 27 | +is possible to append a *release candidate* number in a form `MAJOR.MINOR.PATCHrcNUMBER`. |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +### Rules (concise) |
| 32 | + |
| 33 | +* Format: MAJOR.MINOR.PATCH (e.g., 2.5.1). |
| 34 | + |
| 35 | +* Increment MAJOR when you make incompatible API changes. |
| 36 | + |
| 37 | +* Increment MINOR when you add functionality in a backwards-compatible manner. |
| 38 | + |
| 39 | +* Increment PATCH when you make backwards-compatible bug fixes. |
| 40 | + |
| 41 | +* Release candidates, e.g. 0.6.0rc1 (there is no hyphen!) |
| 42 | + |
| 43 | +* Build metadata: append a plus and metadata ignored for precedence (e.g., |
| 44 | + 1.0.0+20130313144700). |
| 45 | + |
| 46 | +* Precedence: Compare MAJOR, then MINOR, then PATCH numerically; pre-release |
| 47 | + versions have lower precedence than the associated normal version. |
| 48 | + |
| 49 | +## Prerequisites |
| 50 | + |
| 51 | +* Access to https://github.com/lightspeed-core/lightspeed-stack as owner or maintainer |
| 52 | +* Access token to https://pypi.org/ and/or to https://test.pypi.org/py |
| 53 | +* `git` |
| 54 | +* text editor |
| 55 | +* basic file system manipulation tools (`cp`, `rm`) |
| 56 | + |
| 57 | +## Update version in sources |
| 58 | + |
| 59 | +First step is to update version in sources. The version is stored in the file `src/version.py`: |
| 60 | +https://github.com/lightspeed-core/lightspeed-stack/blob/main/src/version.py |
| 61 | + |
| 62 | +Then update the version in other files, especially in tests: |
| 63 | + |
| 64 | +1. src/observability/README.md |
| 65 | +1. tests/e2e/features/info.feature |
| 66 | +1. tests/integration/endpoints/test_rlsapi_v1_integration.py |
| 67 | +1. tests/unit/app/endpoints/conftest.py |
| 68 | +1. tests/unit/observability/test_rlsapi.py |
| 69 | + |
| 70 | +NOTE: there's a task to make this step easier by using the same `version.py` everywhere: |
| 71 | +LCORE-2248: Use only one version value stored in version.py everywhere across the LCORE sources and tests |
| 72 | +https://redhat.atlassian.net/browse/LCORE-2248 |
| 73 | + |
| 74 | +## Regenerate OpenAPI specification |
| 75 | + |
| 76 | +It is needed to generate OpenAPI specification that is stored in `docs/openapi.json`. In order to do it, run the following command: |
| 77 | + |
| 78 | +```bash |
| 79 | +make schema |
| 80 | +``` |
| 81 | + |
| 82 | +NOTE: there's a task to automate these steps: |
| 83 | +LCORE-1647: Automate versioning and changelog generation |
| 84 | +https://redhat.atlassian.net/browse/LCORE-1647 |
| 85 | + |
| 86 | +## Publishing the Python package on PyPi |
| 87 | + |
| 88 | +To publish the service as an Python package on PyPI to be installable by anyone |
| 89 | +(including Konflux hermetic builds), perform the following three steps: |
| 90 | + |
| 91 | +### Cleanup the whole repository |
| 92 | + |
| 93 | +Source and tests folders must contain just source files and README.mds, nothing else. Make sure that all `__pycache__` and `.mypy_cache` directories are deleted (the latest are hidden on Unit systems!) |
| 94 | + |
| 95 | +### Build the distribution archive |
| 96 | + |
| 97 | +```bash |
| 98 | +make distribution-archives |
| 99 | +``` |
| 100 | + |
| 101 | +This command should finish with message: |
| 102 | + |
| 103 | +```text |
| 104 | +Successfully built lightspeed_stack-{version}.tar.gz and lightspeed_stack-{version}-py3-none-any.whl |
| 105 | +``` |
| 106 | + |
| 107 | +Please double check that the `{version}` really contains the correct version number. |
| 108 | +Also please make sure that the archive was really built to avoid publishing older one. |
| 109 | + |
| 110 | +### Upload distribution archives into Python registry |
| 111 | + |
| 112 | +```bash |
| 113 | +make upload-distribution-archives |
| 114 | +``` |
| 115 | + |
| 116 | +The Python registry to where the package should be uploaded can be configured |
| 117 | +by changing `PYTHON_REGISTRY`. It is possible to select `pypi` or `testpypi`. |
| 118 | + |
| 119 | +You might have your API token stored in file `~/.pypirc`. That file should have |
| 120 | +the following form: |
| 121 | + |
| 122 | +```ini |
| 123 | +[testpypi] |
| 124 | + username = __token__ |
| 125 | + password = pypi-{your-API-token} |
| 126 | + |
| 127 | +[pypi] |
| 128 | + username = __token__ |
| 129 | + password = pypi-{your-API-token} |
| 130 | +``` |
| 131 | + |
| 132 | +If this configuration file does not exist, you will be prompted to specify API token from keyboard every time you try to upload the archive. |
| 133 | + |
| 134 | +### Check packages on PyPI and Test PyPI |
| 135 | + |
| 136 | +* https://pypi.org/project/lightspeed-stack/ |
| 137 | +* https://test.pypi.org/project/lightspeed-stack/ |
| 138 | + |
| 139 | +## New tag and release on GitHub |
| 140 | + |
| 141 | +### Create a new tag |
| 142 | + |
| 143 | +1. Open https://github.com/lightspeed-core/lightspeed-stack in a web browser |
| 144 | +1. Go to the *Releases* section and click on *"Draft a new release"* |
| 145 | +1. Create a tag, for example `0.6.0rc1` and fill-in release name such as `Lightspeed Stack version 0.6.0rc1` |
| 146 | +1. Press the button *"Create a release notes"* |
| 147 | +1. Press the button *"Publish release"* |
| 148 | + |
| 149 | +### Update link in `README.md` |
| 150 | + |
| 151 | +At the beggining of `README.md` there's a line: |
| 152 | + |
| 153 | +```text |
| 154 | +[](https://github.com/lightspeed-core/lightspeed-stack/releases/tag/0.5.0) |
| 155 | +``` |
| 156 | + |
| 157 | +Update the link on this line, i.e. replace, for example, `0.5.0` by `0.6.0rc1` |
| 158 | + |
0 commit comments