-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Export the release URL #97
Comments
It's an interesting idea. I'd be open to it. Implementation hint: |
I have a POC of this sort of working, but I wanted to check in and see if it's the right direction and if you all had any early feedback. I would be happy to put together a PR with these changes if that would be more appropriate for feedback/review etc. Here's a branch in my fork: unstable/v1...compilerla:gh-action-pypi-publish:feat/output-release-url ChangesI modified + TWINE_RESULT=$(
TWINE_USERNAME="$INPUT_USER" \
TWINE_PASSWORD="$INPUT_PASSWORD" \
TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \
- exec twine upload ${TWINE_EXTRA_ARGS} ${INPUT_PACKAGES_DIR%%/}/*
+ twine upload ${TWINE_EXTRA_ARGS} ${INPUT_PACKAGES_DIR%%/}/*
+ )
+ TWINE_RETURN=$?
+
+ if [[ "$TWINE_RESULT" =~ View\ at:\ *\(https?://[^[:space:]]+\) ]]; then
+ RELEASE_URL="${BASH_REMATCH[1]}"
+ echo "release-url=$RELEASE_URL" >> "$GITHUB_OUTPUT"
+ fi
+
+ exit $TWINE_RETURN
---
name: pypi-publish
description: Upload Python distribution packages to PyPI
inputs:
...
+ outputs:
+ release-url:
+ description: >-
+ The URL on the package index of the newly uploaded package. Summary
Questions
Any other feedback would be greatly appreciated. |
Thanks for posting the patch! I feel like it might be easier once we migrate the entry point script to Python. I've been meaning to stop accumulating more shell scripts for a while :) Answers
|
This would be amazing, let’s please make this happen! |
One other corner case that wasn't yet mentioned in the discussion is uploading multiple dists of different PyPI projects, possibly even having multiple different release numbers. All these would have different URLs. So said output would probably have to be serialized as a JSON list or something along the lines. Alternatively, we could forbid releasing dists belonging to different PyPI projects or having different versions. As for retrieving the URL, it's probably difficult until Twine has a proper API. There's years of debates about it: pypa/twine#194 / pypa/twine#361. Getting something usable and real into Twine would be a huge win and enable us to use it instead of the CLI with all the cool advantages like accessing attributes of things w/o having to pars stuff spit out onto the console... |
Since both sdist file names and wheel file names are standardized, it’d be easy to infer this information. As you said, rewriting the bash script to Python would probably be the way to go here (especially if sdist names/versions aren’t normalized, I didn’t check) But I also agree about
I just don’t know if it’s practical to wait for something there’s years of debate about. |
@flying-sheep imagine you managed to special-case TestPyPI and PyPI. How do you do that for devpi/nexus/pulp/whatever? Perhaps, it'd be better to just return a mapping of normalized project names to the release version numbers… Or just a series of pairs, letting the end-users render URLs out of that. Imagine I'm uploading the following
to devpi. What would you put into the output called |
to normalized release version numbers, yes! |
So would the output look smth like releases: >-
{"pkg-a": ["1.0", "3.1"], "pkg-b": ["3.0", "6.3"]} ? |
I think that would make sense! |
Hi, it could be cool if you can export the release URL
The text was updated successfully, but these errors were encountered: