Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate PyPI releases via GitHub Actions #132

Closed
amureki opened this issue Nov 11, 2022 · 4 comments · Fixed by #138
Closed

Automate PyPI releases via GitHub Actions #132

amureki opened this issue Nov 11, 2022 · 4 comments · Fixed by #138
Assignees

Comments

@amureki
Copy link
Collaborator

amureki commented Nov 11, 2022

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

@amureki amureki self-assigned this Nov 11, 2022
@jairhenrique
Copy link
Contributor

@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
Copy link
Collaborator Author

amureki commented Nov 11, 2022

@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
Copy link
Contributor

@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
Copy link
Collaborator Author

amureki commented Nov 11, 2022

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

@amureki amureki linked a pull request Nov 15, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants