Skip to content

Commit

Permalink
sync publish script with starlette (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-oleshkevich authored Jun 27, 2024
1 parent d6806ac commit 22e8b2a
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions scripts/publish
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
#!/bin/sh -e

export VERSION=`cat broadcaster/__init__.py | grep __version__ | sed "s/__version__ = //" | sed "s/'//g"`
export PREFIX=""
VERSION_FILE="broadcaster/__init__.py"

if [ -d 'venv' ] ; then
export PREFIX="venv/bin/"
PREFIX="venv/bin/"
else
PREFIX=""
fi

scripts/clean
if [ ! -z "$GITHUB_ACTIONS" ]; then
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action"

if ! command -v "${PREFIX}twine" &>/dev/null ; then
echo "Unable to find the 'twine' command."
echo "Install from PyPI, using '${PREFIX}pip install twine'."
exit 1
fi
VERSION=`grep __version__ ${VERSION_FILE} | grep -o '[0-9][^"]*'`

if ! command -v "${PREFIX}wheel" &>/dev/null ; then
echo "Unable to find the 'wheel' command."
echo "Install from PyPI, using '${PREFIX}pip install wheel'."
if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then
echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'"
exit 1
fi
fi

find broadcaster -type f -name "*.py[co]" -delete
find broadcaster -type d -name __pycache__ -delete
set -x

${PREFIX}python setup.py sdist bdist_wheel
${PREFIX}twine upload dist/*
#${PREFIX}mkdocs gh-deploy

echo "You probably want to also tag the version now:"
echo "git tag -a ${VERSION} -m 'version ${VERSION}'"
echo "git push --tags"

scripts/clean

0 comments on commit 22e8b2a

Please sign in to comment.