diff --git a/.github/workflows/pypipublish.yml b/.github/workflows/pypipublish.yml new file mode 100644 index 00000000..0d085e09 --- /dev/null +++ b/.github/workflows/pypipublish.yml @@ -0,0 +1,45 @@ +name: Publish Python + +on: + release: + types: [published] + +jobs: + tests: + name: run tests + uses: ./.github/workflows/unittest.yml + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to TestPyPI + needs: [tests] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_TEST_KEY }} + repository_url: https://test.pypi.org/legacy/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_KEY }} diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 750dfb45..5886303c 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -1,7 +1,6 @@ name: Python package -on: - pull_request: +on: [workflow_call, pull_request] jobs: build: