File size: 486 Bytes
714e7c4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/usr/bin/env python3
"""
Determine the name of the sdist and export to GitHub output named SDIST_NAME.
To run:
$ python3 -m build --sdist
$ ./ci/determine_sdist_name.py
"""
import os
from pathlib import Path
import sys
paths = [p.name for p in Path("dist").glob("*.tar.gz")]
if len(paths) != 1:
sys.exit(f"Only a single sdist is supported, but found: {paths}")
print(paths[0])
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"SDIST_NAME={paths[0]}\n")
|