-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·44 lines (32 loc) · 1.42 KB
/
Copy pathpush.sh
File metadata and controls
executable file
·44 lines (32 loc) · 1.42 KB
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
#!/bin/bash
set -e
CARGO_FILE="Cargo.toml"
BORER_CORE_CARGO="../borer-core/Cargo.toml"
current_version=$(grep -E '^version = "' "$CARGO_FILE" | head -1 | sed 's/version = "\(.*\)"/\1/')
major=$(echo "$current_version" | cut -d. -f1)
minor=$(echo "$current_version" | cut -d. -f2)
patch=$(echo "$current_version" | cut -d. -f3)
new_patch=$((patch + 1))
new_version="${major}.${minor}.${new_patch}"
echo "Shuttle Version: $current_version -> $new_version"
core_version=$(grep -E '^version = "' "$BORER_CORE_CARGO" | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "Borer-core Version: $core_version"
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/^version = \"$current_version\"/version = \"$new_version\"/" "$CARGO_FILE"
sed -i '' "s/borer-core = { version=\"[^\"]*\"/borer-core = { version=\"$core_version\"/" "$CARGO_FILE"
else
sed -i "s/^version = \"$current_version\"/version = \"$new_version\"/" "$CARGO_FILE"
sed -i "s/borer-core = { version=\"[^\"]*\"/borer-core = { version=\"$core_version\"/" "$CARGO_FILE"
fi
if grep -q '^\[patch\.crates-io\]' "$CARGO_FILE"; then
awk '
/^\[patch\.crates-io\]/ { skip=1; next }
skip && /^\[/ { skip=0 }
!skip { print }
' "$CARGO_FILE" > "$CARGO_FILE.tmp" && mv "$CARGO_FILE.tmp" "$CARGO_FILE"
echo "Removed [patch.crates-io] section"
fi
make check
git commit -a -m "bump version to $new_version"
git push
echo "Done! Version bumped to $new_version and pushed."