From 4ed2e06186c9f627c7ecfd5a38e27b74c5055b24 Mon Sep 17 00:00:00 2001 From: Maik Riechert Date: Fri, 4 Nov 2022 18:21:48 +0000 Subject: [PATCH] Upload package to PyPI from CI Signed-off-by: Maik Riechert --- .github/workflows/python-package.yml | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) 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/*