-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
51 lines (42 loc) · 1.21 KB
/
publish.sh
File metadata and controls
51 lines (42 loc) · 1.21 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
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Publish KARN to PyPI and npm
# Usage: ./publish.sh [--test]
# --test = upload to test servers (testpypi, npm --dry-run)
set -e
TEST=false
if [ "$1" = "--test" ]; then
TEST=true
fi
echo "=== Building KARN for distribution ==="
# Clean previous builds
rm -rf dist/ build/ *.egg-info
# ── PyPI ──
echo ""
echo "=== Building PyPI package ==="
python3 -m pip install --upgrade build twine
python3 -m build
if [ "$TEST" = true ]; then
echo "Uploading to TestPyPI..."
python3 -m twine upload --repository testpypi dist/*
echo "Install from TestPyPI: pip install --index-url https://test.pypi.org/simple/ karn-lang"
else
echo "Uploading to PyPI..."
python3 -m twine upload dist/*
echo "Install from PyPI: pip install karn-lang"
fi
# ── npm ──
echo ""
echo "=== Building npm package ==="
if [ "$TEST" = true ]; then
echo "Dry-run npm publish..."
npm publish --dry-run
else
echo "Publishing to npm..."
npm publish
echo "Install from npm: npm install karn-lang"
fi
echo ""
echo "=== Done ==="
echo "PyPI: https://pypi.org/project/karn-lang/"
echo "npm: https://www.npmjs.com/package/karn-lang"
echo "GitHub: https://github.com/karn-lang/karn"