-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·80 lines (62 loc) · 1.23 KB
/
run.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
if [[ "${BASH_SOURCE-}" != "$0" ]]; then
echo "this script should not be sourced, and must executed in a new shell"
return
fi
set -e
SCRIPT_NAME=$(echo "$0" | awk -F/ '{print $NF}')
SCRIPT_PATH=$(cd "${0:0:-$(($(echo /"${SCRIPT_NAME}" | wc -c) - 1))}" && pwd)
cd "$SCRIPT_PATH"
##
[[ -f ".env" ]] && source .env
case $1 in
'')
echo "test"
echo "build"
echo "clean"
echo "publish_pypi_test"
echo "publish_pypi"
echo "publish_private"
echo "install"
echo "update"
;;
test)
pytest
;;
build)
poetry build
;;
clean)
rm dist/*
;;
publish_pypi_test)
(
poetry config repositories.testpypi "https://test.pypi.org/legacy/"
poetry config pypi-token.testpypi "$TESTPYPI_TOKEN"
poetry publish --build -r testpypi
)
;;
publish_pypi)
(
poetry config repositories.pypi "https://upload.pypi.org/legacy/"
poetry config pypi-token.pypi "$PYPI_TOKEN"
poetry publish --build -r pypi
)
;;
publish_private)
(
poetry config repositories.priv_repo "${REPO_URL}"
poetry config http-basic.priv_repo "${REPO_USER}" "${REPO_PASSWORD}"
poetry publish -v -r priv_repo
)
;;
install)
poetry install
;;
update)
poetry update
;;
*)
echo "unknown command"
;;
esac