-
Notifications
You must be signed in to change notification settings - Fork 2
/
publish.sh
47 lines (38 loc) · 990 Bytes
/
publish.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
if [ $# -ne 1 ]
then
echo "$0 VERSION"
exit 1
fi
version=$1
set -o errexit
check_files() {
if ! grep --quiet --fixed-strings --line-regexp "version = \"$version\"" Cargo.toml
then
echo "Make sure the version has been bumped in Cargo.toml"
exit 1
fi
if ! grep --quiet --fixed-strings --line-regexp "## Version $version" CHANGELOG.md
then
echo "Make sure the change log has an entry for this version."
exit 1
fi
}
check_files
if [ -n "$( git status --porcelain=v1 )" ]
then
echo "Error: local tree has modified files."
git status
exit 1
fi
git fetch origin
git checkout origin/main
# Sanity check to ensure `main` has the same release tags
check_files
cargo publish --dry-run
# This errors on a few conditions that the above doesn't, including uncommitted files.
cargo package --list > /dev/null
echo "Press <Enter> to continue to publish version $version to GitHub and crates.io."
read
git tag v$version
git push origin v$version
cargo publish