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 statusandgit difffor any untracked local changes and handle as needed - Sync from
upstreamrepo, push tooriginand 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-XYZand push toupstream:git switch -c prepare-release-XYZthengit push -u upstream prepare-release-XYZ
- Check
MANIFEST.inandsetup.cfgto 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 buildto update build deps - Run
python -m pip install --upgrade -r requirements-build.txtto install updated build deps - Run
python -X dev tools/generate_requirements_files.pyto update all reqs files - Run
pip install --upgrade -r requirements-dev.txtinstall updated dev deps - Run
pip install -e .to ensure package install is up to date - Run
pip checkto verify environment integrity - Run
python -bb -X dev -W error -m pytest --run-onlineand fix any issues - Run
pre-commit run --all-filesand fix any issues - Sync back changes to dev machine and fixup prior commit
- Push and test on PR and
git reset --hardon Pi
- Address any outstanding trivial tweaks with hooks
- Run
pre-commit autoupdateto update hooks - Manually check
additional_dependenciesfor updates and update as needed - Check hook/dep changelogs and add/update any new settings
- Run
pre-commit run --all-filesand fix any issues - Run
python -bb -X dev -W error -m pytest --run-onlineand 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.
deactivatethenpython3 -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 submanagerthensystemctl --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,journalctllog output and on sub
- Skim
README.md,CONTRIBUTING.mdandRELEASE.mdto ensure they are up to date and render correctly on Github, and commit any changes - Update
ROADMAP.mdto remove current release and add plans for next release(s), commit and verify rendering - Add
CHANGELOG.mdentries for current version, commit and verify rendering - Update version in
submanager/__init__.pyand SECURITY.md to release version and commit as "Release Sub Manager version X.Y.Z" - Check
hub syncandgit statusone 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
statusandjournalctl
-
Close Github milestone
-
Switch to master/release branch and sync:
git switch master/git switch X.Y.Zthenhub 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 mastergit push upstream stagingIf from a release branch:git push upstream X.Y.xgit 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
masterin the dev env:git switch masterthengit 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