name: ytld-sub PyPI Push on: push: # Publish `master` as Docker `latest` image. branches: - master # Publish `v1.2.3` tags as releases. tags: - v* # Run tests for any PRs. pull_request: jobs: build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI runs-on: ubuntu-22.04 strategy: matrix: python-version: [ "3.10" ] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Build Wheel run: | make wheel - name: Publish distribution 📦 to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ - name: Publish distribution 📦 to PyPI if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }} uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }}