-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·51 lines (41 loc) · 1.28 KB
/
build.sh
File metadata and controls
executable file
·51 lines (41 loc) · 1.28 KB
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
#!/bin/bash
# Builds dist package files and a new git tag for the current commit.
function delete_dist_files() {
rm -rf \
dist/ \
src/piano_analytics_api/_version.py
}
set -euo pipefail
projectdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# projectnaam="$(basename "$projectdir")"
# tempdir="/tmp/dist_$projectnaam/"
cd "$projectdir"
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [[ $(git rev-parse --abbrev-ref HEAD) != "master" ]]; then
echo "Op branch $current_branch ipv master. Toch doorgaan? (j/n)"
read -r ans
if [[ $ans != "j" ]]; then
exit 1
fi
fi
./set-env.sh
source env/bin/activate
if ! git status --porcelain=v1 2>/dev/null | wc -l; then
git status
echo "There are uncommitted changes."
exit 1
fi
head_version=$(git tag --points-at HEAD)
if [[ $head_version != "" ]]; then
echo "HEAD is on existing version $head_version. Make a new commit to publish a new version"
exit 1
fi
prev_version="$(git tag --list 'v*' --sort=v:refname | tail -n1)"
echo -e "\nThe latest version is $prev_version. New version (without v)? "
read -r new_version
git_version="v$new_version"
git tag "$git_version"
git push
git push origin "$git_version"
python3 -m build
python3 -m twine upload dist/*-"$new_version"*