forked from Rikorose/DeepFilterNet
-
Notifications
You must be signed in to change notification settings - Fork 3
/
post-release.sh
executable file
·42 lines (33 loc) · 1.47 KB
/
post-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
#!/bin/bash
set -e
MODIFIED=$(fd "(pyproject)|(Cargo)" -t f -e toml -X git diff --name-only {})
[[ -n "$MODIFIED" ]] && { echo "Project files are modified:" && echo "$MODIFIED" && exit 1; }
CUR_VERSION=$(sed -nr "/^\[package\]/ { :l /^version[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" libDF/Cargo.toml | tr -d "\"")
# Increment last part
VERSION=$(echo "$CUR_VERSION" | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')-pre
set_version() {
FILE=$1
VERSION=$2
sed -i "0,/^version/s/^version *= *\".*\"/version = \"$VERSION\"/" "$FILE"
}
export -f set_version
fd "(pyproject)|(Cargo)" -t f -e toml -x bash -c "set_version {} $VERSION"
(
cd DeepFilterNet/
# Workaround for 'poetry add ../pyDF/' which gives some obscure error message
sed -i "s/^deepfilterlib.*/deepfilterlib = { path = \"..\/pyDF\/\" }/" pyproject.toml
sed -i "s/^deepfilterdataloader.*/deepfilterdataloader = { path = \"..\/pyDF-data\/\", optional = true }/" pyproject.toml
)
echo cargo add --manifest-path ./pyDF/Cargo.toml --features transforms --path ./libDF
# cargo add --manifest-path ./pyDF/Cargo.toml --features transforms --path ./libDF deep_filter
# cargo add --manifest-path ./pyDF-data/Cargo.toml --features dataset --path ./libDF deep_filter
cargo update
(
cd DeepFilterNet/
echo "Running poetry update"
poetry update
echo "done"
git add poetry.lock
)
fd "(pyproject)|(Cargo)" -I -t f -e toml -e lock -X git add {}
git commit -m "post-release v$VERSION"