diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index f5279f7..e16e40c 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,10 +1,12 @@ -name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI +name: Publish to PyPI -on: push +on: + push: + branches: [main] jobs: build-n-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + name: Build and publish runs-on: ubuntu-22.04 steps: @@ -31,12 +33,6 @@ jobs: --outdir dist/ . - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.TEST_PYPI_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@master diff --git a/.github/workflows/publish-to-testpypi.yml b/.github/workflows/publish-to-testpypi.yml new file mode 100644 index 0000000..998b366 --- /dev/null +++ b/.github/workflows/publish-to-testpypi.yml @@ -0,0 +1,40 @@ +name: Publish to TestPyPI + +on: + push: + branches: [develop] + +jobs: + build-n-publish: + name: Build and publish + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@master + + - name: Set up Python 3.12 + uses: actions/setup-python@v1 + with: + python-version: 3.12 + + - 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@master + with: + password: ${{ secrets.TEST_PYPI_TOKEN }} + repository_url: https://test.pypi.org/legacy/ \ No newline at end of file