-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrelease
executable file
·54 lines (42 loc) · 1.1 KB
/
release
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
#!/bin/bash
set -e
confirm() {
while true; do
read -p "$1? Please double check. y/n? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit 1;;
* ) echo "Please answer yes or no.";;
esac
done
}
cargo fmt --all -- --check
echo "✔ code formatting looks good!"
cargo check
echo "✔ types look good"
cargo readme > README.md
echo "✔ README.md compiled"
cargo test > /dev/null
echo "✔ tests are passing"
confirm "Updated Cargo.toml"
confirm "Updated CHANGELOG.md"
version="$1"
version_without_v="`sed \"s/v//g\" <(echo $version)`"
if (echo $version | egrep "v\d+\.\d+\.\d+" > /dev/null)
then
confirm "Ready to release $version (as $version_without_v)?"
else
echo "Invalid version number: $1"
exit 1
fi
version_in_toml=$(cat Cargo.toml | egrep "^version = \"$version_without_v\"")
if [[ "$version_in_toml" == "version = \"$version_without_v\"" ]]
then
true
else
echo "Cargo.toml isn't set to version $version_without_v"
fi
GIT_COMMITTER_DATE=$(git log -n1 --pretty=%aD) git tag -a -m "Release $version" $version
git push --tags
cargo publish --dry-run
cargo publish || true