From 527872ef9032eed70d95b2d5c4a65363b6577afd Mon Sep 17 00:00:00 2001 From: "Akeem T. L. King" Date: Tue, 28 Jul 2026 19:05:44 -0400 Subject: [PATCH] Make the publish script upload by default --- scripts/publish.sh | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index ec548c59..69adee94 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,6 +1,17 @@ #!/usr/bin/env bash set -euo pipefail +usage() { + cat <<'EOF' +Usage: + scripts/publish.sh [--check|--dry-run] + +By default this builds, validates, and uploads the current pyproject.toml +version to PyPI. Use --check or --dry-run to build and validate without +uploading. +EOF +} + version="$(python3 - <<'PY' try: import tomllib @@ -12,6 +23,25 @@ with open("pyproject.toml", "r", encoding="utf-8") as handle: PY )" +upload=true +case "${1:-}" in + "") + ;; + "--upload") + ;; + "--check"|"--dry-run") + upload=false + ;; + "-h"|"--help") + usage + exit 0 + ;; + *) + usage >&2 + exit 2 + ;; +esac + has_pypirc_credentials() { local pypirc="${PYPIRC_PATH:-$HOME/.pypirc}" @@ -51,11 +81,10 @@ ensure_pypi_credentials() { python3 -m build python3 -m twine check "dist/torbot-${version}"* -if [[ "${1:-}" == "--upload" ]]; then +if [[ "$upload" == true ]]; then ensure_pypi_credentials python3 -m twine upload "dist/torbot-${version}"* else - echo "Publishing is ready. Run the following when you have your PyPI token:" - echo "python3 -m twine upload dist/torbot-${version}*" - echo "Or run: scripts/publish.sh --upload" + echo "Package artifacts for torbot ${version} are ready." + echo "Run scripts/publish.sh to upload them to PyPI." fi