diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2d967b0..36a0f07 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -5,9 +5,7 @@ name: Python package on: push: - branches: [ "master", "develop" ] pull_request: - branches: [ "master", "develop" ] jobs: build: @@ -97,3 +95,30 @@ jobs: cp -r tests/ tmp_for_test/ cd tmp_for_test pytest + + release: + needs: [lint, test] + + runs-on: ubuntu-latest + + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Download package from artifacts + uses: actions/download-artifact@v3 + with: + name: dist + path: dist + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + pip install twine + + - name: Upload package to PyPI + run: | + twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing dist/*