Skip to content

Commit

Permalink
chore: manual release sdist
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm committed Mar 6, 2023
1 parent 4f79a60 commit 9ac6ecd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
with:
fetch-depth: 0 # fetch all tags and branches
- name: Checkout
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
Expand All @@ -50,14 +44,6 @@ jobs:
python -m venv venv
source venv/bin/activate
pip install dist/*.tar.gz && python -c "import whispercpp as w;print(dir(w.api)); print(dir(w.audio));"
- name: Upload to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
pip install twine
twine upload dist/* --repository pypi --verbose
build-arm-wheels:
name: Build ARM wheels for ${{ matrix.python[1] }}-${{ matrix.platform[0] }}
runs-on: ${{ matrix.platform[1] }}
Expand Down
28 changes: 27 additions & 1 deletion tools/release
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -exu
set -e

if [ "$#" -eq 1 ]; then
VERSION=$1
Expand All @@ -21,6 +21,14 @@ fi
GIT_ROOT=$(git rev-parse --show-toplevel)
cd "$GIT_ROOT" || exit 1

# This script should only be run by me :smile:
if [ ! -f "$HOME"/.pypirc ]; then
# about .pypirc file:
# https://docs.python.org/3/distutils/packageindex.html#the-pypirc-file
echo "Error: File \$HOME/.pypirc not found."
exit 1
fi

if [ -d "$GIT_ROOT"/dist ]; then
echo "Removing existing 'dist' and 'build' directory to get a clean build"
rm -rf "$GIT_ROOT"/dist
Expand All @@ -29,6 +37,10 @@ fi

tag_name="v$VERSION"

echo "Install dependencies"

pip install twine wheel build

if git rev-parse "$tag_name" > /dev/null 2>&1; then
echo "git tag '$tag_name' exist, using existing tag."
echo "To redo releasing and overwrite existing tag, delete tag with the following and re-run release.sh:"
Expand All @@ -46,3 +58,17 @@ else

git push origin "$tag_name"
fi

echo "Generating PyPI source distribution..."
cd "$GIT_ROOT" || exit 1

python -m build -s

# Use testpypi by default, run script with: "REPO=pypi release.sh" for
# releasing to Pypi.org
REPO=${REPO:=testpypi}

echo "Uploading sdist to $REPO..."
twine upload --repository "$REPO" dist/* --verbose

echo "Done releasing version $VERSION."

0 comments on commit 9ac6ecd

Please sign in to comment.