-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-release.sh
More file actions
41 lines (33 loc) · 858 Bytes
/
package-release.sh
File metadata and controls
41 lines (33 loc) · 858 Bytes
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
# Abort on error
set -e
# Check if rye is installed
if ! command -v rye &> /dev/null
then
echo "rye could not be found"
echo "Installing rye"
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
source "$HOME/.rye/env"
fi
# Build
rye build --clean
# Delete old folder if exists
rm -rf package-test
# Test as newly installed package
mkdir -p package-test
cd package-test
rye init
rye add --path ../dist/prompttrail-*-py3-none-any.whl prompttrail
rye add pytest
rye sync
./.venv/bin/pytest --log-cli-level=DEBUG ../tests
cd ..
# Cleanup
rm -rf package-test
# Release if in Github Actions
if [ -n "$GITHUB_ACTIONS" ]; then
echo "Releasing package..."
else
echo "Not in Github Actions, skipping release"
exit 0
fi
rye publish --repository $PYPI_REPOSITORY --repository-url $PYPI_URL --token $PYPI_TOKEN --yes