-
Notifications
You must be signed in to change notification settings - Fork 44
/
release.sh
executable file
·48 lines (40 loc) · 1006 Bytes
/
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
43
44
45
46
47
48
#!/usr/bin/env bash
CRATE=$1
VERSION=$2
CRATES="dinghy-build dinghy-test dinghy-lib cargo-dinghy"
if [ -z "$VERSION" ]
then
echo "Usage: $0 <crate> <version>"
echo crates order is: $CRATES
exit 1
fi
set -ex
if ! [[ $(git --no-pager log HEAD^..HEAD --pretty=format:"%s") == "changelog for $VERSION" ]] && [[ -z "${SKIP_CHANGELOG_CHECK}" ]]
then
echo "Please generate the changelog first using ./pre-release $VERSION"
exit 1
fi
if [ "$CRATE" = "all" ]
then
for c in $CRATES
do
SKIP_CHANGELOG_CHECK=1 $0 $c $VERSION
done
exit 0
fi
# set_version cargo-dinghy/Cargo.toml 0.3.0
set_version() {
FILE=$1
VERSION=$2
sed -i.back "s/^version *= *\".*\"/version = \"$2\"/" $FILE
sed -i.back "s/^\(dinghy-[^ =]*\).*/\\1 = \"$2\"/" $FILE
}
set_version $CRATE/Cargo.toml $VERSION
git commit . -m "release $CRATE/$VERSION"
(cd $CRATE ; cargo publish)
if [ "$CRATE" = "cargo-dinghy" ]
then
git tag "cargo-dinghy/$VERSION"
git push --tags
fi
sleep 15