Cibuildwheel: For GH Actions, use gh-action-pypi-publish instead of twine

Created on 1 Jun 2020  路  10Comments  路  Source: joerick/cibuildwheel

There are some "problems"/tricks described when using twine with this action.
Use dedicated GH action instead?

- name: Publish to PyPI
  uses: pypa/gh-action-pypi-publish@master
  with:
    user: __token__
    password: ${{ secrets.pypi_password }}
    repository_url: https://test.pypi.org/legacy/ #TODO rm for real pypi
    packages_dir: ./wheelhouse/

All 10 comments

:+1: - good idea. If you have time, adding an example config to the /examples dir would be nice :)

Closing this for now, as https://github.com/pypa/gh-action-pypi-publish is only supported on Linux :-(

I believe this is how you upload:

https://scikit-hep.org/developer/gha_wheels#publishing

(Will be tested on the next release of boost-histogram)

You just need a upload artifacts (useful anyway for checking the results if you haven't published yet), it makes sure you have no errors in any of the builds (no partial uploads), and is a good place to make the sdist. I don't think there's much to be gained in making the upload action multi platform or adding the ability to skip existing; this is a good workflow.

Also see setuptools_scm for a nice example of an upload. Be sure to use v2 of upload and download actions.

In the past I had no luck with gha, this action works flawlessly for me

- name: GitHub Release C++ (deploy)
  if: (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags'))
  uses: softprops/action-gh-release@v1
  with:
    files: |
      dist/htm_core-v*
      dist/*.whl
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I believe this is how you upload:

https://scikit-hep.org/developer/gha_wheels#publishing

Ah, great. Thanks! So if I understand correctly, it still only works on Linux, but you just run a separate job (or whatever the terminology is in GHA) that collects all wheels from other jobs?

Worth noting this twine check, btw. It's a good idea to run it as well. But if you need to run that anyway, is there a huge advantage to using the separate action to upload it, rather than using twine?

Yes. The important part really is the collect all in a linux job - that's what ensures all wheels really build before you publish any of them. If Windows wheels fail, you don't get everything-but-Windows uploaded.

Check might be added to the action: https://github.com/pypa/gh-action-pypi-publish/issues/30

And you could just use twine, I don't think that's a problem - but the design should look like this, rather than twines in each job.

Alright. Thanks for the clarification! :-)
Let's get #362 in, then!

Can we get the path fixes into #362?

@henryiii, which path fixes? The dist/ vs. wheelhouse/ thing? I just committed those

Yep, looks good!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kavvkon picture kavvkon  路  7Comments

YannickJadoul picture YannickJadoul  路  7Comments

ax3l picture ax3l  路  11Comments

ysig picture ysig  路  8Comments

bluesheeptoken picture bluesheeptoken  路  5Comments