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

add pypa/gh-action-pypi-publish #717

Merged
merged 8 commits into from May 13, 2024
Merged

Conversation

altendky
Copy link
Contributor

@altendky altendky commented Mar 13, 2024

PyPA has provided a specific action for uploading to PyPI. https://github.com/pypa/gh-action-pypi-publish It can be used in various ways but my understanding is that the trusted publisher mode is preferred. Instructions for the 'authorization' setup are provided at https://docs.pypi.org/trusted-publishers/adding-a-publisher/.

Draft for:

  • identifying the preferred method for triggering a publish to PyPI
  • implementing the proper condition to replace the presently hard coded if: false
  • intel: [macos-12] #735

@altendky
Copy link
Contributor Author

@miniupnp, do you already have implemented, or have in mind, a mechanism for triggering releases on GitHub that you want to use for the automated upload to PyPI? If so, I can look into how to create the proper condition to implement that here.

@miniupnp
Copy link
Owner

@miniupnp, do you already have implemented, or have in mind, a mechanism for triggering releases on GitHub that you want to use for the automated upload to PyPI? If so, I can look into how to create the proper condition to implement that here.

https://github.com/miniupnp/miniupnp/blob/master/appveyor.yml#L102C1-L102C94
--skip-existing is what is done ;)

@altendky
Copy link
Contributor Author

I was referring more to what action you want to result in an upload. Do you want it to publish when you push a tag? Manually trigger the workflow (dispatch it in Actions speak, I believe)? Initiate a GitHub release?

Or maybe you are saying you always run the upload step every time the building is done and since you have --skip-existing it just doesn't upload anything new until the first run with a bumped version?

@miniupnp
Copy link
Owner

Or maybe you are saying you always run the upload step every time the building is done and since you have --skip-existing it just doesn't upload anything new until the first run with a bumped version?

That's it ;)

@miniupnp miniupnp self-assigned this Mar 19, 2024
@altendky
Copy link
Contributor Author

Ok, so we have a bit of a special start case here then. You'll probably want to delete the following two lines whenever you want to do a release. If we take them out now it will start trying to upload immediately. It will presumably fail for my external PR. But... on master it would run if you have the rest setup.

        # TODO: identify the desired condition
        if: false

I have a couple more things to add. I set this up over in pytest-twisted over the weekend and found a couple things I had missed here.

@altendky
Copy link
Contributor Author

Ah, looks like I only forgot it over there and here is ok actually.

@altendky altendky marked this pull request as ready for review March 20, 2024 14:48
@altendky altendky marked this pull request as draft May 9, 2024 13:48
@altendky altendky mentioned this pull request May 9, 2024
@altendky
Copy link
Contributor Author

altendky commented May 9, 2024

@miniupnp, does if: startsWith(github.ref, 'refs/tags') seem like a reasonable upload condition to you? I know we talked about how we are using the skip existing option so as to just upload every time, but this seems a bit safer. For example, without this then the first successful run with access to the secrets (such as you merging this PR) would result in the first release being published.

Also looks like the build needs a fix. From https://github.com/miniupnp/miniupnp/actions/workflows/miniupnpc_wheels.yml?query=branch%3Amaster it looks like 752507e broke it, but that is just a comment change so it seems more likely that some not-pinned dependency changed? Maybe you will recognize the error.

        building 'miniupnpc' extension
        creating build/temp.linux-x86_64-cpython-38
        creating build/temp.linux-x86_64-cpython-38/src
        gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iinclude -I/opt/python/cp38-cp38/include/python3.8 -c src/miniupnpcmodule.c -o build/temp.linux-x86_64-cpython-38/src/miniupnpcmodule.o
        src/miniupnpcmodule.c: In function ‘UPnP_selectigd’:
        src/miniupnpcmodule.c:166:7: error: too few arguments to function ‘UPNP_GetValidIGD’
           r = UPNP_GetValidIGD(self->devlist, &self->urls, &self->data,
               ^~~~~~~~~~~~~~~~
        In file included from src/miniupnpcmodule.c:12:
        include/miniupnpc.h:122:1: note: declared here
         UPNP_GetValidIGD(struct UPNPDev * devlist,
         ^~~~~~~~~~~~~~~~
        error: command '/opt/rh/devtoolset-8/root/usr/bin/gcc' failed with exit code 1
        [end of output]

@miniupnp
Copy link
Owner

miniupnp commented May 9, 2024

2b4c0c5 has fixed the build.

@miniupnp
Copy link
Owner

miniupnp commented May 9, 2024

@miniupnp, does if: startsWith(github.ref, 'refs/tags') seem like a reasonable upload condition to you?

thats ok !

@altendky altendky closed this May 9, 2024
@altendky altendky reopened this May 9, 2024
@altendky altendky closed this May 9, 2024
@altendky altendky reopened this May 9, 2024
@altendky
Copy link
Contributor Author

altendky commented May 9, 2024

I think we're good now. Remember to follow the instructions for the 'authorization' setup provided at https://docs.pypi.org/trusted-publishers/adding-a-publisher/.

@altendky altendky marked this pull request as ready for review May 9, 2024 17:08
@miniupnp
Copy link
Owner

I think we're good now. Remember to follow the instructions for the 'authorization' setup provided at https://docs.pypi.org/trusted-publishers/adding-a-publisher/.

done.
image

@miniupnp miniupnp merged commit add6ced into miniupnp:master May 13, 2024
64 of 91 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants