diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3da9e99..eb66b8d 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,37 +1,35 @@ -name: Publish Python 🐍 distributions 📦 to PyPI +name: Build and Upload to PyPI + +on: + push: + branches: + - main # Adjust to your main branch name -on: push jobs: - build-and-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI + build: runs-on: ubuntu-latest + steps: - - name: Check out repository code - uses: actions/checkout@v4.1.1 + - name: Checkout Repository + uses: actions/checkout@v2 - # Setup Python (faster than using Python container) - - name: Setup Python + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: "3.x" + python-version: 3.x # Specify the Python version you're using - - name: Install pipenv + - name: Install Dependencies run: | - python -m pip install --upgrade pipenv wheel - - id: cache-pipenv - uses: actions/cache@v1 - with: - path: ~/.local/share/virtualenvs - key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + python -m pip install --upgrade pip + pip install setuptools wheel twine - - name: Install dependencies - if: steps.cache-pipenv.outputs.cache-hit != 'true' + - name: Build Package run: | - pipenv install --deploy --dev - - name: Build a binary wheel and a source tarball + python setup.py sdist bdist_wheel + + - name: Upload to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: | - pipenv run build - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_API_TOKEN }} + python -m twine upload --skip-existing dist/*