Skip to content

Commit

Permalink
feat: release scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm committed Feb 28, 2023
1 parent f326a1e commit 0f3b0f3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "whispercpp: Pybind11 bindings for whisper.cpp"
readme = { file = "README.md", content-type = "text/markdown" }
license = { text = "Apache-2.0" }
requires-python = ">=3.8"
version = "0.0.5"
version = "0.0.6"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand Down
39 changes: 39 additions & 0 deletions tools/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e

if [ "$#" -eq 1 ]; then
VERSION_STR=$1
else
echo "Must provide release version string, e.g. ./script/release.sh 1.0.5"
exit 1
fi

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-]+)*)?$"

if [[ "$VERSION_STR" =~ $SEMVER_REGEX ]]; then
echo "Releasing whispercpp version v$VERSION_STR:"
else
echo "Warning: version $VERSION_STR must follow semantic versioning schema, ignore this for preview releases"
fi

GIT_ROOT=$(git rev-parse --show-toplevel)
cd "$GIT_ROOT" || exit 1

if [ -d "$GIT_ROOT"/dist ]; then
echo "Removing existing 'dist' and 'build' directory to get a clean build"
rm -rf "$GIT_ROOT"/dist
rm -rf "$GIT_ROOT"/build
fi

tag_name="v$VERSION_STR"

if git rev-parse "$tag_name" > /dev/null 2>&1; then
echo "git tag '$tag_name' exist, using existing tag."
echo "To redo releasing and overwrite existing tag, delete tag with the following and re-run release.sh:"
echo "git tag -d $tag_name && git push --delete origin $tag_name"
git checkout "$tag_name"
else
echo "Creating git tag '$tag_name'"
git tag -a "$tag_name" -m "Tag generated by tools/release, version: $VERSION_STR"
git push origin "$tag_name"
fi

0 comments on commit 0f3b0f3

Please sign in to comment.