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 Publishing on Github Release #682

Open
derks opened this issue May 20, 2024 · 1 comment
Open

Automate PyPi Publishing on Github Release #682

derks opened this issue May 20, 2024 · 1 comment

Comments

@derks
Copy link
Member

derks commented May 20, 2024

The following was removed from PR #681 in order to give it more thought and testing:

.github/workflows/pythonpublish.yml

name: Upload Python Package

on:
  release:
    types: [published]

permissions:
  id-token: write # trusted publishing
  contents: read

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.x'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install build
      - name: Build package
        run: python -m build
      - name: Publish a Python distribution to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1

PR comments from @sigma67:

I added this to simplify pypi uploads - I use the same workflow in my projects

All you need to do is create a release and the rest will be taken care of by pypi

All you need to do is set up trusted publishing in your pypi settings (not hard to do)

https://docs.pypi.org/trusted-publishers/

@sigma67
Copy link
Contributor

sigma67 commented May 20, 2024

Happy to answer questions regarding this workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants