gh-action-pypi-publish
gh-action-pypi-publish copied to clipboard
[traceback] zipfile.BadZipFile: File is not a zip file
I'm on a python project and i use github action to publish my pypi python package the python project is https://github.com/daisseur/Deltacode_project/ when the package is publishing i got this error:
Traceback (most recent call last):
File "/usr/local/bin/twine", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/twine/__main__.py", line 33, in main
error = cli.dispatch(sys.argv[1:])
File "/usr/local/lib/python3.9/site-packages/twine/cli.py", line 123, in dispatch
return main(args.args)
File "/usr/local/lib/python3.9/site-packages/twine/commands/check.py", line 183, in main
return check(parsed_args.dists, strict=parsed_args.strict)
File "/usr/local/lib/python3.9/site-packages/twine/commands/check.py", line 129, in check
warnings, is_ok = _check_file(filename, render_warning_stream)
File "/usr/local/lib/python3.9/site-packages/twine/commands/check.py", line 73, in _check_file
package = package_file.PackageFile.from_filename(filename, comment=None)
File "/usr/local/lib/python3.9/site-packages/twine/package.py", line 96, in from_filename
meta = DIST_TYPES[dtype](filename)
File "/usr/local/lib/python3.9/site-packages/twine/wininst.py", line [17](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:18), in __init__
self.extractMetadata()
File "/usr/local/lib/python3.9/site-packages/pkginfo/distribution.py", line 1[23](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:24), in extractMetadata
data = self.read()
File "/usr/local/lib/python3.9/site-packages/twine/wininst.py", line 33, in read
archive = zipfile.ZipFile(fqn)
File "/usr/local/lib/python3.9/zipfile.py", line 1[26](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:27)6, in __init__
self._RealGetContents()
File "/usr/local/lib/python3.9/zipfile.py", line 1[33](https://github.com/daisseur/Deltacode_project/actions/runs/4769442414/jobs/8479836531#step:7:34)3, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
Checking dist/DeltacodeProject.exe:
Remove dist/DeltacodeProject.exe. It can't be published.
Remove
dist/DeltacodeProject.exe. It can't be published.
Okay thank you but how can I remove it from the github action whithout remove the exe from the repo
@daisseur firstly, committing binaries to Git repositories is a bad idea. Second, if that's an artifact, it should probably be built within a GHA workflow. Finally, even if you put it into the directory on disk, you can still delete it in GHA via rm -f dist/*.exe or use a different directory for producing/supplying dists. You don't even need a repository checkout for the publishing job — build whatever you're publishing in one job (or many jobs, for that matter), store it as an artifact, get the artifact within the publishing job and make sure you don't add undesired files into that folder.
@webknjaz okay thank you
Action item:
- [ ] Update the README to mention that only the dists recognized by Twine are expected and anything else is unsupported
We're trying to publish with .whl files and we're seeing this issue publishing pyktx:
https://github.com/KhronosGroup/KTX-Software/actions/runs/7498674379/job/20414169920
There is also a .tar.gz source distribution in the directory. I wonder how the wheels are supposed to be published?
We're trying to publish with
.whlfiles and we're seeing this issue publishing pyktx:
This was due to curl command used to download the assets in our GitHub Action not enabling redirects resulting in zero-byte .whl files. Sorry for the false alarm.