-
Notifications
You must be signed in to change notification settings - Fork 15
/
release.sh
executable file
·68 lines (57 loc) · 1.32 KB
/
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
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
#!/bin/bash
VERSION=$1
check_argument_specified() {
if [[ -z $VERSION ]]; then
error_message "You should specify a version number as argument"
fi
}
check_version_format() {
if [[ ! $VERSION =~ ^[0-9]+.[0-9]+.[0-9]+[0-9A-Za-z]*$ ]]; then
error_message "Wrong format version"
fi
}
check_branch() {
branch=`git rev-parse --abbrev-ref HEAD`
if [[ "$branch" != "master" ]]; then
error_message "Current branch should be 'master'"
fi
}
update_version() {
sed -i "s/SILKAJ_VERSION = \".*\"/SILKAJ_VERSION = \"$VERSION\"/" silkaj/constants.py
poetry version "$VERSION"
git diff
}
commit_tag() {
git commit silkaj/constants.py pyproject.toml -m "v$VERSION"
git tag "v$VERSION" -a -m "$VERSION"
}
build() {
if [[ -z $VIRTUAL_ENV ]]; then
error_message "Activate silkaj-env"
fi
exec_installed pyinstaller
pyinstaller bin/silkaj --hidden-import=_cffi_backend --hidden-import=_scrypt --onefile
}
checksum() {
# Generate sha256 checksum file
exec_installed sha256sum
cd dist
sha256sum silkaj > silkaj_sha256sum
}
exec_installed() {
if [[ ! `command -v $1` ]]; then
error_message "'$1' is not install on your machine"
fi
}
error_message() {
echo $1
exit
}
check_argument_specified
check_version_format
#check_branch
update_version
commit_tag
#build
#checksum
#error_message "Build and checksum can be found in 'dist' folder"