-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·70 lines (62 loc) · 1.32 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
#!/bin/bash -x
set -e
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
function load-dotenv {
if [! -f '$THIS_DIR/.env' ]; then
echo 'no .env file found'
return 1
fi
while read -r line; do
export "$line"
done < <(grep -v '^#' "${THIS_DIR}/.env" | grep -v '^$')
}
function install {
python -m pip install --editable "$THIS_DIR/[dev]"
}
function build {
python -m build --sdist --wheel "$THIS_DIR/"
}
function lint {
pre-commit run --all-files
}
function lint:ci {
SKIP=no-commit-to-branch pre-commit run --all-file
}
function start {
echo 'start task not implemented'
}
function publish:test {
try-load-dotenv || true
twine upload dist/* \
--repository testpypi \
--username=__token__ \
--password="$TEST_PYPI_TOKEN"
}
function publish:prod {
load-dotenv
twine upload dist/* \
--repository pypi \
--username=__token__ \
--password="$TEST_PYPI_TOKEN"
}
function release:test {
lint
# clean
build
publish:test
}
function release:prod {
release:test
publish:prod
}
function default {
# Default task to execute
start
}
function help {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | cat -n
}
TIMEFORMAT="Task completed in %3lR"
time ${@:-default}