Merge pull request #42 from scheb/tilt-pro #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.7] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get install libbluetooth-dev -y | |
python -m pip install --upgrade pip setuptools==57 wheel twine | |
pip install -r requirements.txt | |
- name: Run Tests | |
run: | | |
python -m unittest discover test | |
- name: Build and publish | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} | |
# On tag, get tag version without v (e.g. v1.0.0 -> 1.0.0, v1.1.1-beta -> 1.1.1-beta) | |
run: | | |
if [[ $GITHUB_REF == "refs/tags/v"* ]]; then | |
echo "Found release tag" | |
PITCH_VERSION=${GITHUB_REF/refs\/tags\/v} | |
else | |
echo "No release tag found" | |
exit 1 | |
fi | |
echo "Using version: $PITCH_VERSION" | |
PITCH_VERSION="$PITCH_VERSION" python pitch/setup.py sdist bdist_wheel | |
twine upload dist/* |