forked from neon-bindings/neon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbump.sh
executable file
·93 lines (68 loc) · 1.89 KB
/
bump.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
DEV=$(dirname $0)
"$DEV/boot.sh" || exit $?
NEON=$(cd $DEV/.. && pwd)
CRATES=("$NEON" "$NEON/crates/neon-build" "$NEON/crates/neon-runtime")
echo_usage() {
echo "Usage: bump.sh [ major | minor | patch | <version> ]"
}
echo_full_usage() {
echo "bump.sh: Bump the Neon version in all relevant places in the repo"
echo
echo_usage
}
die() {
echo_usage
echo
echo $1
exit 1
}
if [ $# -eq 0 ]; then
echo_full_usage
exit 0
fi
if [ $# -ne 1 ]; then
echo_usage
exit 1
fi
DELTA=$1
case "$DELTA" in
-h | --help)
echo_full_usage
exit 0
;;
-*)
die "Unrecognized flag $DELTA."
;;
major | minor | patch)
;;
*)
if ! semver $DELTA > /dev/null 2>&1 ; then
die "Invalid semver version $DELTA."
fi
esac
cargo_add() {
local crate=$1
local dep=$2
local build=$3
local version=$4
cargo add --manifest-path=$crate/Cargo.toml $dep $build --vers "=${version}" --path crates/$dep
}
old_version=$($DEV/version.sh)
"$DEV/info.sh" "Bumping crate versions..."
for crate in "${CRATES[@]}" ; do
(cd "$crate" && cargo bump $DELTA)
done
new_version=$($DEV/version.sh)
"$DEV/info.sh" "Bumping crate dependencies..."
cargo_add $NEON neon-runtime "" ${new_version}
cargo_add $NEON neon-build --build ${new_version}
"$DEV/info.sh" "Bumping template dependencies..."
sed -i~ \
-e "s/^[[:space:]]*neon-build[[:space:]]*=[[:space:]]\\\"${old_version}\\\"*[[:space:]]*/neon-build = \"${new_version}\"/g" \
-e "s/^[[:space:]]*neon[[:space:]]*=[[:space:]]\\\"${old_version}\\\"*[[:space:]]*/neon = \"${new_version}\"/g" \
cli/templates/Cargo.toml.hbs
"$DEV/info.sh" "Bumping CLI version..."
(cd "$NEON/cli" && npm version --no-git-tag-version $DELTA) || exit $?
modified=$(git status -s | grep '^ M ' | awk '{ print $2; }' | fgrep -v package-lock.json)
git diff $modified