A step by step checklist for cutting a new release.
Note: This guide uses hub
to sync branches more easily, but it can be substituted with switching to the master
/release branch and running git pull upstream <BRANCH-NAME>
.
- Preliminaries
- Update pinned dependencies
- Update pre-commit hooks
- Build and test on RPi/production machine
- Transition new version to production on RPi
- Update documentation and finish release PR
- Rebuild and upload to PyPI on RPi/production machine
- Re-install production release on Pi
- Finalize release
- Cleanup on the RPi/production machine
- Cleanup locally
- Check that no release steps need updating
- Ensure all issues/PRs linked to Github milestone are closed or moved to next release
- Check
git status
andgit diff
for any untracked local changes and handle as needed - Sync from
upstream
repo, push toorigin
and clean up old branches:git fetch --all
, thenhub sync
/git pull upstream
, thengit push origin
, and finallygit branch -d <BRANCH>
andgit push -d <REMOTE> <BRANCH>
for any branches - Create a new branch
prepare-release-XYZ
and push toupstream
:git switch -c prepare-release-XYZ
thengit push -u upstream prepare-release-XYZ
- Check
MANIFEST.in
andsetup.cfg
to ensure they are up to date and all data files are included - Check each dependency for new upper bound version and examine changelogs for breaking changes
- Commit and push if changes made to run regen deps on Linux machine (RPi), and open PR against base branch
- On RPi, activate env and run
python -X dev tools/generate_requirements_files.py build
to update build deps - Run
python -m pip install --upgrade -r requirements-build.txt
to install updated build deps - Run
python -X dev tools/generate_requirements_files.py
to update all reqs files - Run
pip install --upgrade -r requirements-dev.txt
install updated dev deps - Run
pip install -e .
to ensure package install is up to date - Run
pip check
to verify environment integrity - Run
python -bb -X dev -W error -m pytest --run-online
and fix any issues - Run
pre-commit run --all-files
and fix any issues - Sync back changes to dev machine and fixup prior commit
- Push and test on PR and
git reset --hard
on Pi
- Address any outstanding trivial tweaks with hooks
- Run
pre-commit autoupdate
to update hooks - Manually check
additional_dependencies
for updates and update as needed - Check hook/dep changelogs and add/update any new settings
- Run
pre-commit run --all-files
and fix any issues - Run
python -bb -X dev -W error -m pytest --run-online
and fix any issues - Commit changes, push & test on PR
- Pull latest changes from release branch down to RPi
- Activate the existing dev virtual environment: e.g.
source env/bin/activate
- Delete existing
dist/
if present:rm -rfd dist
- Build source and wheel distributions:
python -bb -X dev -W error -m build
- Check with twine:
twine check --strict dist/*
- Create a fresh, clean virtual environment, e.g.
deactivate
thenpython3 -m venv clean-env
- Activate the new environment, e.g.
source clean-env/bin/activate
- Install/upgrade core install deps in new environment:
python -m pip install --upgrade pip setuptools wheel
- Install the build in the new environment:
pip install dist/submanager-X.Y.Z.dev0-py3-none-any.whl[test]
- Check the env with pip:
pip check
- Test the installed version:
python -bb -X dev -W error -m pytest --run-online
- Fix any bugs, commit, push and retest
- Disable and stop production service:
systemctl --user disable submanager
thensystemctl --user stop submanager
- Activate production venv (e.g.
source env/bin/activate
) - Upgrade core install deps
python -m pip install --upgrade pip setuptools wheel
- Install/upgrade pinned deps from requirements file:
pip install --upgrade -r requirements.txt
- Install package from built wheel:
pip install dist/submanager-X.Y.Z.dev0-py3-none-any.whl
- Ensure config/state dir names, locations and structure is up to date
- Sync static config and praw.ini from dev machine
- Update local dynamic config as needed
- Validate config with
python -b -X dev -m submanager validate-config
- Start running and verify nominal performance:
python -b -X dev -m submanager start
- Install service with
python -bb -X dev -W error -m submanager install-service
- Enable and start service, wait 30 seconds and verify
status
,journalctl
log output and on sub
- Skim
README.md
,CONTRIBUTING.md
andRELEASE.md
to ensure they are up to date and render correctly on Github, and commit any changes - Update
ROADMAP.md
to remove current release and add plans for next release(s), commit and verify rendering - Add
CHANGELOG.md
entries for current version, commit and verify rendering - Update version in
submanager/__init__.py
and SECURITY.md to release version and commit as "Release Sub Manager version X.Y.Z" - Check
hub sync
andgit status
one more time, and then push to the PR and wait for checks to pass
- Repeat steps 0 through 4 (inclusive) in "Build and test on RPi" section to rebuild release version
- Install built wheel in dev environment:
pip install dist/submanager-X.Y.Z.dev0-py3-none-any.whl[lint,test]
- Verify version is correct:
submanager --version
- Run basic tests one last time:
python -bb -X dev -W error -m pytest
- Merge PR and wait for checks to pass
- Upload to live PyPI:
twine upload dist/*
- Check for any errors in service, and then disable and stop
- Activate production environment, e.g.
source env/bin/activate
- Install release version from PyPI:
pip install --upgrade submanager
- Verify version is correct:
submanager --version
- Enable and restart service, wait 30 seconds and verify no errors occur with
status
andjournalctl
-
Close Github milestone
-
Switch to master/release branch and sync:
git switch master
/git switch X.Y.Z
thenhub sync
-
Tag release:
git tag -a vX.Y.Z -m "Sub Manager version X.Y.Z"
-
Push tags:
git push upstream --tags
-
Create a Github release from the tag and with the version's changelog, plus any important notices up top
-
Increment
__init__.__version__
to next release and re-adddev0
(ordev<N+1>
, if a pre-release) -
If a release from
master
, i.e. new major or minor version, create release branch to maintain it:git switch -c X.Y.x git push -u origin X.Y.x git push upstream X.Y.z git switch master
-
Commit change to
master
/ release branch with message: "Begin development of version X.Y.x" -
If from
master
, pushmaster
&staging
:git push upstream master
git push upstream staging
If from a release branch:git push upstream X.Y.x
git push upstream staging-release
-
Update your fork's master branch:
git push origin master
-
Open a Github milestone as needed for the next release
- Switch and re-pull
master
in the dev env:git switch master
thengit pull upstream master
- Re-install dev build; with the dev env activated, run:
pip install -e .[lint,test]
- Verify version with
submanager --version
- Remove clean test environment (
test-env
) anddist/
on RPi - Delete any other old services, config files, dirs and environments on RPi
- Ensure everything is synced:
hub sync
- Re-install dev build locally:
pip install -e .[lint,test]
- Verify version with
submanager --version
- Delete the prepare release branch locally:
git branch -d prepare-release-XYZ
- Delete the branch on the remote:
git branch -d upstream prepare-release-XYZ