-
Notifications
You must be signed in to change notification settings - Fork 4
/
prepare_release.sh
executable file
·54 lines (43 loc) · 1.33 KB
/
prepare_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
#!/bin/sh
set -e
PROJECT_VERSION="$1"
if [ -z "$1" ]; then
echo "No version supplied"
exit 1
fi
if ! command -v "ruff" &>/dev/null; then
echo "please install ruff for formatting the python wrapper"
exit 1
fi
if ! command -v "gofumpt" &>/dev/null; then
echo "please install gofumpt for formatting the go code"
exit 1
fi
if [ "$(git tag -l "${PROJECT_VERSION}")" ]; then
echo "Version: ${PROJECT_VERSION} already has a tag"
exit 1
fi
# First check if th
if [[ $(git diff) ]]; then
echo "There are changes, commit them before releasing"
exit 1
fi
# Format all go files
git ls-files | grep '.go$' | xargs -I {} gofumpt -w {} >/dev/null
if [[ $(git diff) ]]; then
git add -u
git commit -m "Format: Run Gofumpt"
fi
# Format all Python files
git ls-files | grep '.py$' | xargs -I {} ruff format --quiet {} >/dev/null
if [[ $(git diff) ]]; then
git add -u
git commit -m "Format: Run Ruff"
fi
# Replace version number
# replace in internal/version
sed -i "s/const Version = \".*\"/const Version = \"${PROJECT_VERSION}\"/" internal/version/version.go
sed -i "s/version = .*/version = ${PROJECT_VERSION}/" wrappers/python/setup.cfg
sed -i "s/__version__ = \".*\"/__version__ = \"${PROJECT_VERSION}\"/" wrappers/python/eduvpn_common/__init__.py
git add -u
git commit -m "Version: Update to ${PROJECT_VERSION}"