Skip to content

Commit

Permalink
Add release helper scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lack committed Feb 20, 2020
1 parent 99356f3 commit 1eb8870
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build/
dist/
*.egg-info/
__pycache__
pypi.*key
18 changes: 18 additions & 0 deletions tools/dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
if [[ ! -d .git ]]; then
echo "$0 must be run from the project root"
exit 1
fi
rm -rf dist build soundcraft_utils.egg-info
if [[ $VERSION_SUFFIX ]]; then
echo "Overriding version with $VERSION_SUFFIX"
ORIG=soundcraft/__init__.py
BAK=${ORIG}.bak
if [[ -f $BAK ]]; then
echo "$BAK already exists"
exit 1
fi
sed -i.bak -e "s/^\\(__version__ = ['\"][^'\"]*\\)/\\1$VERSION_SUFFIX/" $ORIG
fi
python3 setup.py sdist bdist_wheel
[[ -f $BAK ]] && mv $BAK $ORIG
11 changes: 11 additions & 0 deletions tools/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
TOOLS=$(dirname $0)
grep version soundcraft/__init__.py
echo -n "About to release; are you sure? [y/N] "
read answer
if [[ ! $answer =~ ^[yY] ]]; then
echo "Exiting"
exit 1
fi
$TOOLS/dist.sh || exit 1
python3 -m twine upload --user __token__ --password $(<$TOOLS/pypi.realkey) dist/*
16 changes: 16 additions & 0 deletions tools/testupload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
TOOLS=$(dirname $0)
export VERSION_SUFFIX=$1
if [[ ! $VERSION_SUFFIX ]]; then
echo "usage: $0 [a1|b1|rc1]"
exit 1
fi
if [[ ! $VERSION_SUFFIX =~ ^(a|b|rc)[0-9]+$ ]]; then
echo "Suffix must be one of:"
echo " a2"
echo " b5"
echo " rc1"
exit 2
fi
$TOOLS/dist.sh || exit 1
python3 -m twine upload --user __token__ --password $(<$TOOLS/pypi.testkey) --repository-url https://test.pypi.org/legacy/ dist/*

0 comments on commit 1eb8870

Please sign in to comment.