Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.2
current_version = 0.4.3
commit = True
tag = True

Expand Down
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ python -m build

## Release process

* Update version in `pyproject.toml` and `src/lionweb/__init__.py`
* Create tag: `git tag -a v0.1.1 -m "Version 0.1.1"`
* Release on PyPI:

```
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
```
* Push tag
Releases are published to PyPI from a local machine with `release.sh`.

1. Install the release tools: `pip install bump2version build twine`, and configure
your PyPI credentials in `~/.pypirc`.
2. On `main`, move the entries of the upcoming version into their section in
`CHANGELOG.md`, commit and push.
3. Run `./release.sh` (or `./release.sh minor` / `./release.sh major`).

The script checks that you are on a clean `main` in sync with `origin/main`, then:

* bumps the version in `src/lionweb/__init__.py` (the only place it is written;
`pyproject.toml` reads it from there) and in `.bumpversion.cfg`, committing the
change and creating the `vX.Y.Z` tag
* builds the sdist and wheel into `dist/`
* pushes `main` and the tag
* uploads the package to PyPI
35 changes: 28 additions & 7 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
#!/bin/bash
# Publishes a new release to PyPI. See "Release process" in README.md.
# Usage: ./release.sh [patch|minor|major] (default: patch)

set -e # Stop on errors
set -euo pipefail

# Bump version
bump2version patch # Change to minor or major if needed
PART="${1:-patch}"
case "$PART" in
patch|minor|major) ;;
*) echo "Usage: $0 [patch|minor|major]" >&2; exit 1 ;;
esac

# Push changes
git push origin --tags
# Only release an up-to-date, clean main
if [ "$(git branch --show-current)" != "main" ]; then
echo "Releases must be made from main" >&2; exit 1
fi
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
echo "There are uncommitted changes" >&2; exit 1
fi
git fetch origin main --tags
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then
echo "Local main is not in sync with origin/main" >&2; exit 1
fi

rm -Rf dist
# Bump version: commits and creates the vX.Y.Z tag
bump2version "$PART"
VERSION=$(sed -n 's/^current_version = //p' .bumpversion.cfg)

# Build the package
rm -Rf dist
python -m build
twine check dist/*

# Push the bump commit and the tag
git push origin main "v$VERSION"

# Upload to PyPI
twine upload --repository custom-pypi --config-file ~/.pypirc --non-interactive dist/*
twine upload --config-file ~/.pypirc --non-interactive dist/*
2 changes: 1 addition & 1 deletion src/lionweb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.4.2"
__version__ = "0.4.3"
from .lionweb_version import LionWebVersion

__all__ = ["LionWebVersion"]
Loading