Considering the main project repository is setup as "upstream" remote for git...
- Pull and check dependencies are there.
git pull upstream `git rev-parse --abbrev-ref HEAD`
pip install -U pip wheel twine git-semver medikit
- Update version.txt with the new version number
VERSION_FILE=`python setup.py --name | sed s@\\\.@/@g`/_version.py
git fetch upstream --tags
echo "__version__ = '"`git semver --next-patch`"'" > $VERSION_FILE
git add $VERSION_FILE
And maybe update the frozen dependencies and makefile content (medikit managed projects only)
make update-requirements
Generate a changelog...
git log --oneline --no-merges --pretty=format:"* %s (%an)" `git tag | tail -n 1`..
And paste it to project changelog, then format a bit. Everything that only concerns non-code stuff should be removed (documentation, etc.) and maybe some commits grouped so it's more readable for an human, and more logically organized than the raw git log.
vim docs/changelog.rst
If you have formating to do, now is the time...
QUICK=1 make format && git add -p .
- Run a full test, from a clean virtualenv
make clean install test docs
- Create the git release
git commit -m "release: "`python setup.py --version`
git tag -am `python setup.py --version` `python setup.py --version`
# Push to origin
git push origin `git rev-parse --abbrev-ref HEAD` --tags
# Push to upstream
git push upstream `git rev-parse --abbrev-ref HEAD` --tags
- (open-source) Create the distribution in a sandbox directory & upload to PyPI (multi python versions).
pip install -U twine; (VERSION=`python setup.py --version`; rm -rf .release; mkdir .release; git archive `git rev-parse $VERSION` | tar xf - -C .release; cd .release/; for v in 3.6 3.7 3.8 3.9; do pip$v install -U wheel; python$v setup.py sdist bdist_egg bdist_wheel; done; twine upload dist/*-`python setup.py --version`*)
And maybe, test that the release is now installable...
(name=`python setup.py --name`; for v in 3.6 3.7 3.8 3.9; do python$v -m pip install -U virtualenv; python$v -m virtualenv -p python$v .rtest$v; cd .rtest$v; bin/pip --no-cache-dir install $name; bin/python -c "import $name; print($name.__name__, $name.__version__);"; cd ..; rm -rf .rtest$v; done; )
Note that for PRERELEASES, you must add --pre to pip install arguments.
(name=`python setup.py --name`; for v in 3.6 3.7 3.8 3.9; do python$v -m pip install -U virtualenv; python$v -m virtualenv -p python$v .rtest$v; cd .rtest$v; bin/pip --no-cache-dir install --pre $name; bin/python -c "import $name; print($name.__name__, $name.__version__);"; cd ..; rm -rf .rtest$v; done; )
- (private) Build containers, push and patch kubernetes
make release push rollout
- (private, old gen) Deploy with capistrano
cap (pre)prod deploy
All this process is currently being migrated to "medikit pipelines" (alpha feature).
medikit pipeline release start
Use at own risks