-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·40 lines (35 loc) · 1.03 KB
/
Copy pathpublish.sh
File metadata and controls
executable file
·40 lines (35 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# Build and publish otelio to PyPI with uv.
# Usage: ./publish.sh # build + upload to PyPI
# ./publish.sh --test # build + upload to TestPyPI
#
# Reads PYPI_API_TOKEN from .env (gitignored). On PyPI create a token at
# https://pypi.org/manage/account/token/ and put it in .env as:
# PYPI_API_TOKEN=pypi-XXXX...
set -euo pipefail
cd "$(dirname "$0")"
# Load secrets (PYPI_API_TOKEN) from .env if present.
if [ -f .env ]; then
set -o allexport
source .env
set +o allexport
fi
if [ -z "${PYPI_API_TOKEN:-}" ]; then
echo "error: PYPI_API_TOKEN is not set (add it to .env or export it)." >&2
exit 1
fi
# Clean previous artifacts and build fresh sdist + wheel into ./dist.
rm -rf dist build ./*.egg-info
uv build --out-dir dist .
if [[ "${1:-}" == "--test" ]]; then
uv publish \
--publish-url https://test.pypi.org/legacy/ \
--username __token__ \
--password "$PYPI_API_TOKEN" \
dist/*
else
uv publish \
--username __token__ \
--password "$PYPI_API_TOKEN" \
dist/*
fi