Bogdanp / django_dramatiq

A Django app that integrates with Dramatiq.
https://dramatiq.io
Other
331 stars 77 forks source link

Automate PyPI releases via GitHub Actions #132

Closed amureki closed 1 year ago

amureki commented 1 year ago

On every new published GitHub release, we could trigger python -m twine upload dist/*

jairhenrique commented 1 year ago

@amureki suggestion

name: Publish to PyPI

on:
  push:
    tags:
      - "*"

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: "3.10"

      - name: Build
        run: |
          pip install -U pip
          pip install wheel
          python setup.py sdist bdist_wheel 

      - name: Publish a Python distribution to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          password: ${{ secrets.PYPI_API_TOKEN }}
amureki commented 1 year ago

@jairhenrique thanks, Jair! I was about to go with my "default" go-to solution via twine: https://github.com/model-bakers/model_bakery/blob/main/.github/workflows/release.yml

I see you suggesting "pypa/gh-action-pypi-publish@release/v1" - that is something new to me and I am going check this out. Did you have a good experience with it on your projects? Is this better than good old twine?

jairhenrique commented 1 year ago

@amureki this is only an official pypa action to publish. I've never had any problems using it in my private projects, but classic twine works fine too.

There's some opensource projects using it:

amureki commented 1 year ago

@jairhenrique awesome, I'd be up for trying that. Would you be interested in preparing PR? I am happy to review and test it!