Skip to content

Commit 0f3b0f3

Browse files
committed
feat: release scripts
Signed-off-by: Aaron <[email protected]>
1 parent f326a1e commit 0f3b0f3

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "whispercpp: Pybind11 bindings for whisper.cpp"
88
readme = { file = "README.md", content-type = "text/markdown" }
99
license = { text = "Apache-2.0" }
1010
requires-python = ">=3.8"
11-
version = "0.0.5"
11+
version = "0.0.6"
1212
classifiers = [
1313
"Development Status :: 4 - Beta",
1414
"Intended Audience :: Developers",

tools/release

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
if [ "$#" -eq 1 ]; then
5+
VERSION_STR=$1
6+
else
7+
echo "Must provide release version string, e.g. ./script/release.sh 1.0.5"
8+
exit 1
9+
fi
10+
11+
SEMVER_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
12+
13+
if [[ "$VERSION_STR" =~ $SEMVER_REGEX ]]; then
14+
echo "Releasing whispercpp version v$VERSION_STR:"
15+
else
16+
echo "Warning: version $VERSION_STR must follow semantic versioning schema, ignore this for preview releases"
17+
fi
18+
19+
GIT_ROOT=$(git rev-parse --show-toplevel)
20+
cd "$GIT_ROOT" || exit 1
21+
22+
if [ -d "$GIT_ROOT"/dist ]; then
23+
echo "Removing existing 'dist' and 'build' directory to get a clean build"
24+
rm -rf "$GIT_ROOT"/dist
25+
rm -rf "$GIT_ROOT"/build
26+
fi
27+
28+
tag_name="v$VERSION_STR"
29+
30+
if git rev-parse "$tag_name" > /dev/null 2>&1; then
31+
echo "git tag '$tag_name' exist, using existing tag."
32+
echo "To redo releasing and overwrite existing tag, delete tag with the following and re-run release.sh:"
33+
echo "git tag -d $tag_name && git push --delete origin $tag_name"
34+
git checkout "$tag_name"
35+
else
36+
echo "Creating git tag '$tag_name'"
37+
git tag -a "$tag_name" -m "Tag generated by tools/release, version: $VERSION_STR"
38+
git push origin "$tag_name"
39+
fi

0 commit comments

Comments
 (0)