-
Notifications
You must be signed in to change notification settings - Fork 4
/
manage.sh
executable file
·85 lines (66 loc) · 1.57 KB
/
manage.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
81
82
83
84
85
#!/bin/bash
function ssh-config {
mkdir -p ~/.ssh
chmod 700 ~/.ssh
cp -p ${SSH_DIR}/* ~/.ssh
chown -R $(id -un):$(id -gn) ~/.ssh
}
function git-config {
git config --global user.email "${GIT_USER_EMAIL}" > /dev/null 2>&1
git config --global user.name "${GIT_USER_NAME}" > /dev/null 2>&1
}
function setup {
requirements
install-editable
}
function requirements {
pip install --no-cache-dir -r requirements.txt
pip install --no-cache-dir twine
}
function install {
pip install .
}
function install-editable {
pip install -e .
}
function publish {
bump
build
push
}
function bump {
previousVersion=$( grep '^__version__ =' cdrouter/__init__.py | sed 's/__version__ = \"\(.*\)\"/\1/' )
echo "Next version number? (previous: '$previousVersion')"
read version
if [ "$version" = "" ];
then
echo "No version number entered, aborting bump"
exit 1
fi
sed -i -b "s/__version__ = .*/__version__ = \"$version\"/" cdrouter/__init__.py
}
function clean {
rm -rf build cdrouter.egg-info dist
}
function build {
clean
python setup.py sdist bdist_wheel
}
function push {
echo "Break (Ctrl+c) or type 'abort' and hit enter if something is wrong. Else, press enter"
read foobar
if [ "$foobar" = "abort" ];
then
echo "User entered 'abort', aborting push"
exit 1
fi
twine upload dist/*
git commit -am "Publish version $version"
git tag -m "Version $version" v$version
git push --tags origin master
}
while [[ $# -ne 0 ]];
do
$1
shift
done