-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease.sh
executable file
·34 lines (27 loc) · 896 Bytes
/
release.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
#!/usr/bin/env bash
set -exuo pipefail
dir="$(dirname $0)"
# if no arg, increment patch version
if [ -z "$1" ]; then
semver=$(python ${dir}/setup.py --version | sed -n -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*$/\1/p')
major=$(echo $semver | sed -n -E 's/^([0-9]+)\.([0-9]+)\.([0-9]+).*/\1/p')
minor=$(echo $semver | sed -n -E 's/^([0-9]+)\.([0-9]+)\.([0-9]+).*/\2/p')
patch=$(echo $semver | sed -n -E 's/^([0-9]+)\.([0-9]+)\.([0-9]+).*/\3/p')
REL="${major}.${minor}.$((patch+1))"
else
REL="${1}"
fi
# Run all tests
. test.sh
# Tag release
git tag -a v${REL} -m "B23 FlowLib: $(date)" && git push origin v${REL}
# Remove dist/ if it exists
if [ -d $dir/dist ]; then
rm -r $dir/dist
fi
# Build FlowLib
python ${dir}/setup.py sdist
DIST="$(ls $dir/dist)"
set +x
echo ""
echo "Don't forget to upload dist/${DIST} to github: https://github.com/B23admin/b23-flowlib/releases/edit/v${REL}"