README: add new instructions on building & publishing

PyPi requires an API token nowadays, for uploading packages. The README
now includes instructions on how to set those up & use them.
This commit is contained in:
Sybren A. Stüvel 2022-09-12 15:17:30 +02:00
parent 3bcb9bab0e
commit 330b179a44
2 changed files with 37 additions and 1 deletions

View File

@ -131,3 +131,38 @@ This requirement helps to keep Blender add-ons separated, as an add-on can
import the modules of BAT it needs, then remove them from `sys.modules` and import the modules of BAT it needs, then remove them from `sys.modules` and
`sys.path` so that other add-ons don't see them. This should reduce problems `sys.path` so that other add-ons don't see them. This should reduce problems
with various add-ons shipping different versions of BAT. with various add-ons shipping different versions of BAT.
## Publishing a New Release
For uploading packages to PyPi, an API key is required; username+password will
not work.
First, generate an API token at https://pypi.org/manage/account/token/. Then,
use this token when publishing instead of your username and password.
As username, use `__token__`.
As password, use the token itself, including the `pypi-` prefix.
See https://pypi.org/help/#apitoken for help using API tokens to publish. This
is what I have in `~/.pypirc`:
```
[distutils]
index-servers =
bat
# Use `twine upload -r bat` to upload with this token.
[bat]
repository = https://upload.pypi.org/legacy/
username = __token__
password = pypi-abc-123-blablabla
```
```
. ./.venv/bin/activate
pip install twine
poetry build
twine check dist/blender-asset-tracer-1.13.tar.gz dist/blender_asset_tracer-1.13-*.whl
twine upload -r rsa dist/blender-asset-tracer-1.13.tar.gz dist/blender_asset_tracer-1.13-*.whl
```

View File

@ -9,11 +9,12 @@ poetry version $1
sed "s/version = '[^']*'/version = '$1'/" -i docs/conf.py sed "s/version = '[^']*'/version = '$1'/" -i docs/conf.py
sed "s/release = '[^']*'/release = '$1'/" -i docs/conf.py sed "s/release = '[^']*'/release = '$1'/" -i docs/conf.py
sed "s/__version__\s*=\s*\"[^']*\"/__version__ = \"$1\"/" -i blender_asset_tracer/__init__.py sed "s/__version__\s*=\s*\"[^']*\"/__version__ = \"$1\"/" -i blender_asset_tracer/__init__.py
sed --posix "s/\(dist\/blender[_-]asset[_-]tracer-\)\([0-9.betalphdv-]*[0-9]\)/\1$1/g" -i README.md
git diff git diff
echo echo
echo "Don't forget to commit and tag:" echo "Don't forget to commit and tag:"
echo git commit -m \'Bumped version to $1\' pyproject.toml blender_asset_tracer/__init__.py docs/conf.py echo git commit -m \'Bumped version to $1\' pyproject.toml blender_asset_tracer/__init__.py docs/conf.py README.md
echo git tag -a v$1 -m \'Tagged version $1\' echo git tag -a v$1 -m \'Tagged version $1\'
echo echo
echo "Build the package & upload to PyPi using:" echo "Build the package & upload to PyPi using:"