-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathci-prepare-cmd.sh
31 lines (25 loc) · 1.01 KB
/
ci-prepare-cmd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
set -x
set -e
VERSION=$1
bumpversion --allow-dirty --no-commit --no-tag --new-version "$VERSION" patch
# Clean up the files touched by bumpversion
set +e # Allow failure; if files are modified, pre-commit returns an exit code > 0
pre-commit run --all-files end-of-file-fixer
pre-commit run --all-files trailing-whitespace
pre-commit run --all-files prettier
set -e
rm -rf dist/
# Remove certain markers from the .rst file, otherwise twine check will fail with:
# ERROR `long_description` has syntax errors in markup and would not be rendered on PyPI.
sed -i -e 's/:ref://' -e 's/:gitref://' README.rst
poetry build
# https://twine.readthedocs.io/en/latest/#twine-check
twine check dist/*
# The slash at the end is important
# https://github.com/python-poetry/poetry/issues/742#issuecomment-609642943
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config --list
# Hide the password
set +x
poetry publish --repository testpypi --username __token__ --password "$PYPI_TEST_PASSWORD"