|
| 1 | +# Releasing OpenTelemetry Packages (for maintainers only) |
| 2 | +This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number. |
| 3 | + |
| 4 | +Release Process: |
| 5 | +* [Checkout a clean repo](#checkout-a-clean-repo) |
| 6 | +* [Update versions](#update-versions) |
| 7 | +* [Create a new branch](#create-a-new-branch) |
| 8 | +* [Open a Pull Request](#open-a-pull-request) |
| 9 | +* [Create a Release](#Create-a-Release) |
| 10 | +* [Move stable tag](#Move-stable-tag) |
| 11 | +* [Update main](#Update-main) |
| 12 | +* [Check PyPI](#Check-PyPI) |
| 13 | +* [Troubleshooting](#troubleshooting) |
| 14 | + |
| 15 | +## Checkout a clean repo |
| 16 | +To avoid pushing untracked changes, check out the repo in a new dir |
| 17 | + |
| 18 | +## Update versions |
| 19 | +The update of the version information relies on the information in eachdist.ini to identify which packages are stable, prerelease or |
| 20 | +experimental. Update the desired version there to begin the release process. |
| 21 | + |
| 22 | +## Create a new branch |
| 23 | +The following script does the following: |
| 24 | +- update main locally |
| 25 | +- creates a new release branch `release/<version>` |
| 26 | +- updates version and changelog files |
| 27 | +- commits the change |
| 28 | + |
| 29 | +*NOTE: This script was run by a GitHub Action but required the Action bot to be excluded from the CLA check, which it currently is not.* |
| 30 | + |
| 31 | +```bash |
| 32 | +./scripts/prepare_release.sh |
| 33 | +``` |
| 34 | + |
| 35 | +## Open a Pull Request |
| 36 | + |
| 37 | +The PR should be opened from the `release/<version>` branch created as part of running `prepare_release.sh` in the steps above. |
| 38 | + |
| 39 | +## Create a Release |
| 40 | + |
| 41 | +- Create the GH release from the main branch, using a new tag for this micro version, e.g. `v0.7.0` |
| 42 | +- Copy the changelogs from all packages that changed into the release notes (and reformat to remove hard line wraps) |
| 43 | + |
| 44 | + |
| 45 | +## Check PyPI |
| 46 | + |
| 47 | +This should be handled automatically on release by the [publish action](https://github.com/open-telemetry/opentelemetry-python/blob/main/.github/workflows/publish.yml). |
| 48 | + |
| 49 | +- Check the [action logs](https://github.com/open-telemetry/opentelemetry-python/actions?query=workflow%3APublish) to make sure packages have been uploaded to PyPI |
| 50 | +- Check the release history (e.g. https://pypi.org/project/opentelemetry-api/#history) on PyPI |
| 51 | + |
| 52 | +If for some reason the action failed, see [Publish failed](#publish-failed) below |
| 53 | + |
| 54 | +## Move stable tag |
| 55 | + |
| 56 | +This will ensure the docs are pointing at the stable release. |
| 57 | + |
| 58 | +```bash |
| 59 | +git tag -d stable |
| 60 | +git tag stable |
| 61 | +git push --delete origin tagname |
| 62 | +git push origin stable |
| 63 | +``` |
| 64 | + |
| 65 | +To validate this worked, ensure the stable build has run successfully: https://readthedocs.org/projects/opentelemetry-python/builds/. If the build has not run automatically, it can be manually trigger via the readthedocs interface. |
| 66 | + |
| 67 | +## Update main |
| 68 | + |
| 69 | +Ensure the version and changelog updates have been applied to main. Update the versions in eachdist.ini once again this time to include the `.dev0` tag and |
| 70 | +run eachdist once again: |
| 71 | +```bash |
| 72 | +./scripts/eachdist.py update_versions --versions stable,prerelease |
| 73 | +``` |
| 74 | + |
| 75 | +If the diff includes significant changes, create a pull request to commit the changes and once the changes are merged, click the "Run workflow" button for the Update [OpenTelemetry Website Docs](https://github.com/open-telemetry/opentelemetry-python/actions/workflows/docs-update.yml) GitHub Action. |
| 76 | + |
| 77 | +## Hotfix procedure |
| 78 | + |
| 79 | +A `hotfix` is defined as a small change developed to correct a bug that should be released as quickly as possible. Due to the nature of hotfixes, they usually will only affect one or a few packages. Therefore, it usually is not necessary to go through the entire release process outlined above for hotfixes. Follow the below steps how to release a hotfix: |
| 80 | + |
| 81 | +1. Identify the packages that are affected by the bug. Make the changes to those packages, merging to `main`, as quickly as possible. |
| 82 | +2. On your local machine, remove the `dev0` tags from the version number and increment the patch version number. |
| 83 | +3. On your local machine, update `CHANGELOG.md` with the date of the hotfix change. |
| 84 | +4. With administrator privileges for PyPi, manually publish the affected packages. |
| 85 | + a. Install [twine](https://pypi.org/project/twine/) |
| 86 | + b. Navigate to where the `setup.py` file exists for the package you want to publish. |
| 87 | + c. Run `python setup.py sdist bdist_wheel`. You may have to install [wheel](https://pypi.org/project/wheel/) as well. |
| 88 | + d. Validate your built distributions by running `twine check dist/*`. |
| 89 | + e. Upload distributions to PyPi by running `twine upload dist/*`. |
| 90 | +5. Note that since hotfixes are manually published, the build scripts for publish after creating a release are not run. |
| 91 | + |
| 92 | +## Troubleshooting |
| 93 | + |
| 94 | +### Publish failed |
| 95 | + |
| 96 | +If for some reason the action failed, do it manually: |
| 97 | + |
| 98 | +- Switch to the release branch (important so we don't publish packages with "dev" versions) |
| 99 | +- Build distributions with `./scripts/build.sh` |
| 100 | +- Delete distributions we don't want to push (e.g. `testutil`) |
| 101 | +- Push to PyPI as `twine upload --skip-existing --verbose dist/*` |
| 102 | +- Double check PyPI! |
0 commit comments