diff --git a/.github/workflows/python-lint-and-test.yml b/.github/workflows/python-lint-and-test.yml index 23f269b..0b1f6d8 100644 --- a/.github/workflows/python-lint-and-test.yml +++ b/.github/workflows/python-lint-and-test.yml @@ -1,12 +1,16 @@ -name: Python tests +name: Python tests + deploy on: push: branches: - main + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 pull_request: + branches: + - main jobs: - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -40,4 +44,29 @@ jobs: env: PLATFORM: ubuntu-latest BACKEND: pyqt5 - + + deploy: + # this will run when you have tagged a commit, starting with "v*" + # and requires that you have put your twine API key in your + # github secrets (see readme for details) + needs: [test] + runs-on: ubuntu-latest + if: contains(github.ref, 'tags') + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -U wheel twine build + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} + run: | + git tag + python -m build . + twine upload dist/*